diff --git a/adhoc/adhoc.h b/adhoc/adhoc.hpp
similarity index 100%
rename from adhoc/adhoc.h
rename to adhoc/adhoc.hpp
diff --git a/cmd/csd.cc b/cmd/csd.cpp
similarity index 100%
rename from cmd/csd.cc
rename to cmd/csd.cpp
diff --git a/cmd/dump-db.cc b/cmd/dump-db.cpp
similarity index 100%
rename from cmd/dump-db.cc
rename to cmd/dump-db.cpp
diff --git a/disabled/ndnx-tunnel.cpp b/disabled/ndnx-tunnel.cpp
deleted file mode 100644
index 0984d26..0000000
--- a/disabled/ndnx-tunnel.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-tunnel.h"
-#include "ndnx-pco.h"
-
-namespace Ndnx
-{
-
-NdnxTunnel::NdnxTunnel()
-  : NdnxWrapper()
-  , m_localPrefix("/")
-{
-  refreshLocalPrefix();
-}
-
-NdnxTunnel::~NdnxTunnel()
-{
-}
-
-void
-NdnxTunnel::refreshLocalPrefix()
-{
-  Name newPrefix = getLocalPrefix();
-  if (!newPrefix.toString().empty() && m_localPrefix != newPrefix)
-  {
-    NdnxWrapper::clearInterestFilter(m_localPrefix);
-    NdnxWrapper::setInterestFilter(newPrefix, bind(&NdnxTunnel::handleTunneledInterest, this, _1));
-    m_localPrefix = newPrefix;
-  }
-}
-
-int
-NdnxTunnel::sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors)
-{
-  Name tunneledInterest = queryRoutableName(interest);
-
-  NdnxWrapper::sendInterest(tunneledInterest,
-                            TunnelClosure(closure, *this, interest),
-                            selectors);
-
-  return 0;
-}
-
-void
-NdnxTunnel::handleTunneledData(const Name &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback)
-{
-  ParsedContentObject pco(tunneledData);
-  originalDataCallback(pco.name(), pco.content());
-}
-
-int
-NdnxTunnel::publishData(const Name &name, const unsigned char *buf, size_t len, int freshness)
-{
-  Bytes content = createContentObject(name, buf, len, freshness);
-  storeContentObject(name, content);
-
-  return publishContentObject(name, content, freshness);
-}
-
-int
-NdnxTunnel::publishContentObject(const Name &name, const Bytes &contentObject, int freshness)
-{
-  Name tunneledName = m_localPrefix + name;
-  Bytes tunneledCo = createContentObject(tunneledName, head(contentObject), contentObject.size(), freshness);
-  return putToNdnd(tunneledCo);
-}
-
-void
-NdnxTunnel::handleTunneledInterest(const Name &tunneledInterest)
-{
-  // The interest must have m_localPrefix as a prefix (component-wise), otherwise ndnd would not deliver it to us
-  Name interest = tunneledInterest.getPartialName(m_localPrefix.size());
-
-  ReadLock lock(m_ritLock);
-
-  // This is linear scan, but should be acceptable under the assumption that the caller wouldn't be listening to a lot prefixes (as of now, most app listen to one or two prefixes)
-  for (RitIter it = m_rit.begin(); it != m_rit.end(); it++)
-  {
-    // evoke callback for any prefix that is the prefix of the interest
-    if (isPrefix(it->first, interest))
-    {
-      (it->second)(interest);
-    }
-  }
-}
-
-bool
-NdnxTunnel::isPrefix(const Name &prefix, const Name &name)
-{
-  if (prefix.size() > name.size())
-  {
-    return false;
-  }
-
-  int size = prefix.size();
-  for (int i = 0; i < size; i++)
-  {
-    if (prefix.getCompAsString(i) != name.getCompAsString(i))
-    {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-int
-NdnxTunnel::setInterestFilter(const Name &prefix, const InterestCallback &interestCallback)
-{
-  WriteLock lock(m_ritLock);
-  // make sure copy constructor for boost::function works properly
-  m_rit.insert(make_pair(prefix, interestCallback));
-  return 0;
-}
-
-void
-NdnxTunnel::clearInterestFilter(const Name &prefix)
-{
-  WriteLock lock(m_ritLock);
-  // remove all
-  m_rit.erase(prefix);
-}
-
-TunnelClosure::TunnelClosure(const DataCallback &dataCallback, NdnxTunnel &tunnel,
-                             const Name &originalInterest, const TimeoutCallback &timeoutCallback)
-  : Closure(dataCallback, timeoutCallback)
-  , m_tunnel(tunnel)
-  , m_originalInterest(originalInterest)
-{
-}
-
-TunnelClosure::TunnelClosure(const Closure &closure, NdnxTunnel &tunnel, const Name &originalInterest)
-  : Closure(closure)
-  , m_tunnel(tunnel)
-{
-}
-
-Closure *
-TunnelClosure::dup() const
-{
-  return new TunnelClosure (*this);
-}
-
-void
-TunnelClosure::runDataCallback(const Name &name, const Bytes &content)
-{
-  m_tunnel.handleTunneledData(name, content, m_dataCallback);
-}
-
-Closure::TimeoutCallbackReturnValue
-TunnelClosure::runTimeoutCallback(const Name &interest)
-{
-  return Closure::runTimeoutCallback(m_originalInterest);
-}
-
-} // Ndnx
diff --git a/disabled/ndnx-tunnel.h b/disabled/ndnx-tunnel.h
deleted file mode 100644
index 1722eb1..0000000
--- a/disabled/ndnx-tunnel.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_TUNNEL_H
-#define NDNX_TUNNEL_H
-
-#include "ndnx-wrapper.h"
-
-#define _OVERRIDE
-#ifdef __GNUC__
-#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
-  #undef _OVERRIDE
-  #define _OVERRIDE override
-#endif // __GNUC__ version
-#endif // __GNUC__
-
-// Eventually, Sync::NdnxWrapper should be moved to this namespace.
-// It has nothing to do with Sync.
-namespace Ndnx
-{
-
-class NdnxTunnel : public NdnxWrapper
-{
-public:
-  typedef std::multimap<Name, InterestCallback> RegisteredInterestTable;
-  typedef std::multimap<Name, InterestCallback>::iterator RitIter;
-
-
-  NdnxTunnel();
-  virtual ~NdnxTunnel();
-
-  // name is topology-independent
-  virtual int
-  publishData(const Name &name, const unsigned char *buf, size_t len, int freshness) _OVERRIDE;
-
-  int
-  publishContentObject(const Name &name, const Bytes &contentObject, int freshness);
-
-  virtual int
-  sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors = Selectors());
-
-
-  // prefix is topology-independent
-  virtual int
-  setInterestFilter(const Name &prefix, const InterestCallback &interestCallback) _OVERRIDE;
-
-  // prefix is topology-independent
-  // this clears all entries with key equal to prefix
-  virtual void
-  clearInterestFilter(const Name &prefix) _OVERRIDE;
-
-  // subclass should provide translation service from topology-independent name
-  // to routable name
-  virtual Name
-  queryRoutableName(const Name &name) = 0;
-
-  // subclass should implement the function to store ContentObject with topoloy-independent
-  // name to the permanent storage; default does nothing
-  virtual void
-  storeContentObject(const Name &name, const Bytes &content) {}
-
-  // should be called  when connect to a different network
-  void
-  refreshLocalPrefix();
-
-  static bool
-  isPrefix(const Name &prefix, const Name &name);
-
-  void
-  handleTunneledInterest(const Name &tunneldInterest);
-
-  void
-  handleTunneledData(const Name &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback);
-
-private:
-  NdnxTunnel(const NdnxTunnel &other) {}
-
-protected:
-  // need a way to update local prefix, perhaps using macports trick, but eventually we need something more portable
-  Name m_localPrefix;
-  RegisteredInterestTable m_rit;
-  Lock m_ritLock;
-};
-
-class TunnelClosure : public Closure
-{
-public:
-  TunnelClosure(const DataCallback &dataCallback, NdnxTunnel &tunnel,
-                const Name &originalInterest, const TimeoutCallback &timeoutCallback = TimeoutCallback());
-
-  TunnelClosure(const Closure &closure, NdnxTunnel &tunnel, const Name &originalInterest);
-
-  virtual void
-  runDataCallback(const Name &name, const Bytes &content) _OVERRIDE;
-
-  virtual TimeoutCallbackReturnValue
-  runTimeoutCallback(const Name &interest) _OVERRIDE;
-
-  virtual Closure *
-  dup() const;
-
-private:
-  NdnxTunnel &m_tunnel;
-  Name m_originalInterest;
-};
-
-};
-
-#endif
diff --git a/disabled/test-ndnx-tunnel.cc b/disabled/test-ndnx-tunnel.cc
deleted file mode 100644
index baa3ec7..0000000
--- a/disabled/test-ndnx-tunnel.cc
+++ /dev/null
@@ -1,121 +0,0 @@
-#include "ndnx-tunnel.h"
-#include "ndnx-closure.h"
-#include "ndnx-name.h"
-#include "ndnx-pco.h"
-#include <unistd.h>
-
-#include <boost/test/unit_test.hpp>
-
-
-using namespace Ndnx;
-using namespace std;
-using namespace boost;
-
-BOOST_AUTO_TEST_SUITE(NdnxTunnelTests)
-
-class DummyTunnel : public NdnxTunnel
-{
-public:
-  DummyTunnel();
-  virtual ~DummyTunnel() {}
-
-  virtual Name
-  queryRoutableName(const Name &name);
-
-  void
-  overridePrefix();
-
-};
-
-DummyTunnel::DummyTunnel() : NdnxTunnel()
-{
-  m_localPrefix = Name("/local");
-}
-
-void
-DummyTunnel::overridePrefix()
-{
-  NdnxWrapper::setInterestFilter(m_localPrefix, bind(&DummyTunnel::handleTunneledInterest, this, _1));
-}
-
-Name
-DummyTunnel::queryRoutableName (const Name &name)
-{
-  return Name("/local") + name;
-}
-
-NdnxWrapperPtr t1(new DummyTunnel());
-NdnxWrapperPtr t2(new DummyTunnel());
-NdnxWrapperPtr c1(new NdnxWrapper());
-
-DummyTunnel t3;
-
-// global data callback counter;
-int g_dc_i = 0;
-int g_dc_o = 0;
-int g_ic = 0;
-
-void innerCallback(const Name &name, const Bytes &content)
-{
-  g_dc_i ++;
-  string str((const char *)&content[0], content.size());
-  BOOST_CHECK_EQUAL(name, str);
-}
-
-void outerCallback(const Name &name, const Bytes &content)
-{
-  g_dc_o ++;
-}
-
-void interestCallback(const Name &name)
-{
-  string strName = name.toString();
-  t3.publishData(name, (const unsigned char *)strName.c_str(), strName.size(), 5);
-  g_ic++;
-}
-
-BOOST_AUTO_TEST_CASE (NdnxTunnelTest)
-{
-  // test publish
-  string inner = "/hello";
-
-  g_dc_o = 0;
-  t1->publishData(Name(inner), (const unsigned char *)inner.c_str(), inner.size(), 5);
-  usleep(100000);
-
-  c1->sendInterest(Name("/local/hello"), Closure(bind(outerCallback, _1, _2)));
-  usleep(100000);
-  // it is indeed published as /local/hello
-  BOOST_CHECK_EQUAL(g_dc_o, 1);
-
-  g_dc_i = 0;
-  t2->sendInterest(Name(inner), Closure(bind(innerCallback, _1, _2)));
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_dc_i, 1);
-}
-
-BOOST_AUTO_TEST_CASE (NdnxTunnelRegister)
-{
-
-  g_ic = 0;
-  g_dc_i = 0;
-  t3.overridePrefix();
-  t3.setInterestFilter(Name("/t3"), bind(interestCallback, _1));
-  usleep(100000);
-  Closure innerClosure (bind(innerCallback, _1, _2));
-  t1->sendInterest(Name("/t3/hello"), innerClosure);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_dc_i, 1);
-  BOOST_CHECK_EQUAL(g_ic, 1);
-
-  t3.clearInterestFilter(Name("/t3"));
-  usleep(100000);
-  t1->sendInterest(Name("/t3/hello-there"), innerClosure);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_dc_i, 1);
-  BOOST_CHECK_EQUAL(g_ic, 1);
-
-}
-
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/executor/executor.cc b/executor/executor.cc
deleted file mode 100644
index d9f3893..0000000
--- a/executor/executor.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "executor.h"
-#include "logging.h"
-
-INIT_MEMBER_LOGGER(Executor,"Executor")
-
-using namespace std;
-using namespace boost;
-
-Executor::Executor (int poolSize)
-  : m_needStop (true)
-  , m_poolSize (poolSize)
-{
-}
-
-Executor::~Executor()
-{
-  _LOG_DEBUG ("Enter destructor");
-  shutdown ();
-  _LOG_DEBUG ("Exit destructor");
-}
-
-void
-Executor::start ()
-{
-  if (m_needStop)
-    {
-      m_needStop = false;
-      for (int i = 0; i < m_poolSize; i++)
-        {
-          m_group.create_thread (bind(&Executor::run, this));
-        }
-    }
-}
-
-void
-Executor::shutdown ()
-{
-  if (!m_needStop)
-    {
-      m_needStop = true;
-      _LOG_DEBUG ("Iterrupting all");
-      m_group.interrupt_all ();
-      _LOG_DEBUG ("Join all");
-      m_group.join_all ();
-    }
-}
-
-
-void
-Executor::execute(const Job &job)
-{
-  _LOG_DEBUG ("Add to job queue");
-
-  Lock lock(m_mutex);
-  bool queueWasEmpty = m_queue.empty ();
-  m_queue.push_back(job);
-
-  // notify working threads if the queue was empty
-  if (queueWasEmpty)
-  {
-    m_cond.notify_one ();
-  }
-}
-
-int
-Executor::poolSize()
-{
-  return m_group.size();
-}
-
-int
-Executor::jobQueueSize()
-{
-  Lock lock(m_mutex);
-  return m_queue.size();
-}
-
-void
-Executor::run ()
-{
-  _LOG_DEBUG ("Start thread");
-
-  while(!m_needStop)
-  {
-    Job job = waitForJob();
-
-    _LOG_DEBUG (">>> enter job");
-    job (); // even if job is "null", nothing bad will happen
-    _LOG_DEBUG ("<<< exit job");
-  }
-
-  _LOG_DEBUG ("Executor thread finished");
-}
-
-Executor::Job
-Executor::waitForJob()
-{
-  Lock lock(m_mutex);
-
-  // wait until job queue is not empty
-  while (m_queue.empty())
-  {
-    _LOG_DEBUG ("Unlocking mutex for wait");
-    m_cond.wait(lock);
-    _LOG_DEBUG ("Re-locking mutex after wait");
-  }
-
-  _LOG_DEBUG ("Got signal on condition");
-
-  Job job;
-  if (!m_queue.empty ()) // this is not always guaranteed, especially after interruption from destructor
-    {
-      job = m_queue.front();
-      m_queue.pop_front();
-    }
-  return job;
-}
diff --git a/executor/executor.h b/executor/executor.h
deleted file mode 100644
index 6ed3d62..0000000
--- a/executor/executor.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef EXECUTOR_H
-#define EXECUTOR_H
-
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/thread.hpp>
-#include <deque>
-
-#include "logging.h"
-
-/* A very simple executor to execute submitted tasks immediately or
- * in the future (depending on whether there is idle thread)
- * A fixed number of threads are created for executing tasks;
- * The policy is FIFO
- * No cancellation of submitted tasks
- */
-
-class Executor
-{
-public:
-  typedef boost::function<void ()> Job;
-
-  Executor(int poolSize);
-  ~Executor();
-
-  // execute the job immediately or sometime in the future
-  void
-  execute(const Job &job);
-
-  int
-  poolSize();
-
-// only for test
-  int
-  jobQueueSize();
-
-  void
-  start ();
-
-  void
-  shutdown ();
-
-private:
-  void
-  run();
-
-  Job
-  waitForJob();
-
-private:
-  typedef std::deque<Job> JobQueue;
-  typedef boost::mutex Mutex;
-  typedef boost::unique_lock<Mutex> Lock;
-  typedef boost::condition_variable Cond;
-  typedef boost::thread Thread;
-  typedef boost::thread_group ThreadGroup;
-  JobQueue m_queue;
-  Mutex m_mutex;
-  Cond m_cond;
-  ThreadGroup m_group;
-
-  volatile bool m_needStop;
-  int m_poolSize;
-
-  MEMBER_LOGGER
-};
-
-typedef boost::shared_ptr<Executor> ExecutorPtr;
-#endif // EXECUTOR_H
diff --git a/fs-watcher/fs-watcher.cc b/fs-watcher/fs-watcher.cpp
similarity index 100%
rename from fs-watcher/fs-watcher.cc
rename to fs-watcher/fs-watcher.cpp
diff --git a/fs-watcher/fs-watcher.h b/fs-watcher/fs-watcher.hpp
similarity index 100%
rename from fs-watcher/fs-watcher.h
rename to fs-watcher/fs-watcher.hpp
diff --git a/gui/chronosharegui.h b/gui/chronosharegui.hpp
similarity index 100%
rename from gui/chronosharegui.h
rename to gui/chronosharegui.hpp
diff --git a/ndnx/ndnx-cert.cpp b/ndnx/ndnx-cert.cpp
deleted file mode 100644
index 8dacd60..0000000
--- a/ndnx/ndnx-cert.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-#include "ndnx-cert.h"
-#include <tinyxml.h>
-#include <boost/lexical_cast.hpp>
-#include "logging.h"
-
-INIT_LOGGER ("Ndnx.Cert");
-
-using namespace std;
-
-namespace Ndnx {
-
-Cert::Cert()
-    : m_pkey(0)
-    , m_meta("", "",  0, 0)
-{
-}
-
-Cert::Cert(const PcoPtr &keyObject, const PcoPtr &metaObject = PcoPtr())
-    : m_pkey(0)
-    , m_meta("", "", 0, 0)
-{
-  m_name = keyObject->name();
-  m_rawKeyBytes = keyObject->content();
-  m_keyHash = *(Hash::FromBytes(m_rawKeyBytes));
-  m_pkey = ndn_d2i_pubkey(head(m_rawKeyBytes), m_rawKeyBytes.size());
-  updateMeta(metaObject);
-}
-
-Cert::~Cert()
-{
-  if (m_pkey != 0)
-  {
-    ndn_pubkey_free(m_pkey);
-    m_pkey = 0;
-  }
-}
-
-void
-Cert::updateMeta(const PcoPtr &metaObject)
-{
-  if (metaObject)
-  {
-    TiXmlDocument doc;
-    Bytes xml = metaObject->content();
-    // just make sure it's null terminated as it's required by TiXmlDocument::parse
-    xml.push_back('\0');
-    doc.Parse((const char *)(head(xml)));
-    if (!doc.Error())
-    {
-      TiXmlElement *root = doc.RootElement();
-      for (TiXmlElement *child = root->FirstChildElement(); child; child = child->NextSiblingElement())
-      {
-        string elemName = child->Value();
-        string text = child->GetText();
-        if (elemName == "Name")
-        {
-          m_meta.realworldID = text;
-        }
-        else if (elemName == "Affiliation")
-        {
-          m_meta.affiliation = text;
-        }
-        else if (elemName == "Valid_to")
-        {
-          m_meta.validTo = boost::lexical_cast<time_t>(text);
-        }
-        else if (elemName == "Valid_from")
-        {
-          // this is not included in the key meta yet
-          // but it should eventually be there
-        }
-        else
-        {
-          // ignore known stuff
-        }
-      }
-    }
-    else
-    {
-      _LOG_ERROR("Cannot parse meta info:" << std::string((const char *)head(xml), xml.size()));
-    }
-  }
-}
-
-Cert::VALIDITY
-Cert::validity()
-{
-  if (m_meta.validFrom == 0 && m_meta.validTo == 0)
-  {
-    return OTHER;
-  }
-
-  time_t now = time(NULL);
-  if (now < m_meta.validFrom)
-  {
-    return NOT_YET_VALID;
-  }
-
-  if (now >= m_meta.validTo)
-  {
-    return EXPIRED;
-  }
-
-  return WITHIN_VALID_TIME_SPAN;
-}
-
-} // Ndnx
diff --git a/ndnx/ndnx-cert.h b/ndnx/ndnx-cert.h
deleted file mode 100644
index 17f06d5..0000000
--- a/ndnx/ndnx-cert.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_CERT_H
-#define NDNX_CERT_H
-
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-#include "ndnx-pco.h"
-#include "hash-helper.h"
-#include <boost/shared_ptr.hpp>
-
-namespace Ndnx {
-
-class Cert
-{
-public:
-  enum VALIDITY
-  {
-    NOT_YET_VALID,
-    WITHIN_VALID_TIME_SPAN,
-    EXPIRED,
-    OTHER
-  };
-
-  Cert();
-  Cert(const PcoPtr &keyObject, const PcoPtr &metaObject);
-  ~Cert();
-
-  void
-  updateMeta(const PcoPtr &metaObject);
-
-  Name
-  name() { return m_name; }
-
-  Bytes
-  rawKeyBytes() { return m_rawKeyBytes; }
-
-  Hash
-  keyDigest() { return m_keyHash; }
-
-  std::string
-  realworldID() { return m_meta.realworldID; }
-
-  std::string
-  affilication() { return m_meta.affiliation; }
-
-  ndn_pkey *
-  pkey() { return m_pkey; }
-
-  VALIDITY
-  validity();
-
-private:
-  struct Meta
-  {
-    Meta(std::string id, std::string affi, time_t from, time_t to)
-      : realworldID(id)
-      , affiliation(affi)
-      , validFrom(from)
-      , validTo(to)
-    {
-    }
-    std::string realworldID;
-    std::string affiliation;
-    time_t validFrom;
-    time_t validTo;
-  };
-
-  Name m_name;
-  Hash m_keyHash; // publisherPublicKeyHash
-  Bytes m_rawKeyBytes;
-  ndn_pkey *m_pkey;
-  Meta m_meta;
-};
-
-typedef boost::shared_ptr<Cert> CertPtr;
-
-}
-
-#endif // NDNX_CERT_H
diff --git a/ndnx/ndnx-charbuf.cc b/ndnx/ndnx-charbuf.cc
deleted file mode 100644
index 842c840..0000000
--- a/ndnx/ndnx-charbuf.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-charbuf.h"
-
-using namespace std;
-
-namespace Ndnx {
-
-void
-NdnxCharbuf::init(ndn_charbuf *buf)
-{
-  if (buf != NULL)
-  {
-    m_buf = ndn_charbuf_create();
-    ndn_charbuf_reserve(m_buf, buf->length);
-    memcpy(m_buf->buf, buf->buf, buf->length);
-    m_buf->length = buf->length;
-  }
-}
-
-NdnxCharbuf::NdnxCharbuf()
-            : m_buf(NULL)
-{
-  m_buf = ndn_charbuf_create();
-}
-
-NdnxCharbuf::NdnxCharbuf(ndn_charbuf *buf)
-            : m_buf(NULL)
-{
-  init(buf);
-}
-
-NdnxCharbuf::NdnxCharbuf(const NdnxCharbuf &other)
-            : m_buf (NULL)
-{
-  init(other.m_buf);
-}
-
-NdnxCharbuf::NdnxCharbuf(const void *buf, size_t length)
-{
-  m_buf = ndn_charbuf_create ();
-  ndn_charbuf_reserve (m_buf, length);
-  memcpy (m_buf->buf, buf, length);
-  m_buf->length = length;
-}
-
-NdnxCharbuf::~NdnxCharbuf()
-{
-  ndn_charbuf_destroy(&m_buf);
-}
-
-}
diff --git a/ndnx/ndnx-charbuf.h b/ndnx/ndnx-charbuf.h
deleted file mode 100644
index 3007eee..0000000
--- a/ndnx/ndnx-charbuf.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_NDNX_CHARBUF_H
-#define NDNX_NDNX_CHARBUF_H
-
-#include "ndnx-common.h"
-#include <boost/shared_ptr.hpp>
-
-namespace Ndnx {
-
-class NdnxCharbuf;
-typedef boost::shared_ptr<NdnxCharbuf> NdnxCharbufPtr;
-
-//  This class is mostly used in NdnxWrapper; users should not be directly using this class
-// The main purpose of this class to is avoid manually create and destroy charbuf everytime
-class NdnxCharbuf
-{
-public:
-  NdnxCharbuf();
-  NdnxCharbuf(ndn_charbuf *buf);
-  NdnxCharbuf(const NdnxCharbuf &other);
-  NdnxCharbuf(const void *buf, size_t length);
-  ~NdnxCharbuf();
-
-  // expose internal data structure, use with caution!!
-  ndn_charbuf *
-  getBuf() { return m_buf; }
-
-  const ndn_charbuf *
-  getBuf() const { return m_buf; }
-
-  const unsigned char *
-  buf () const
-  { return m_buf->buf; }
-
-  size_t
-  length () const
-  { return m_buf->length; }
-
-private:
-  void init(ndn_charbuf *buf);
-
-protected:
-  ndn_charbuf *m_buf;
-};
-
-}
-
-#endif // NDNX_NDNX_CHARBUF_H
diff --git a/ndnx/ndnx-closure.cpp b/ndnx/ndnx-closure.cpp
deleted file mode 100644
index 1a96582..0000000
--- a/ndnx/ndnx-closure.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-closure.h"
-
-namespace Ndnx {
-
-Closure::Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback)
-  : m_timeoutCallback (timeoutCallback)
-  , m_dataCallback (dataCallback)
-{
-}
-
-Closure::~Closure ()
-{
-}
-
-void
-Closure::runTimeoutCallback(Name interest, const Closure &closure, Selectors selectors)
-{
-  if (!m_timeoutCallback.empty ())
-    {
-      m_timeoutCallback (interest, closure, selectors);
-    }
-}
-
-
-void
-Closure::runDataCallback(Name name, PcoPtr content)
-{
-  if (!m_dataCallback.empty ())
-    {
-      m_dataCallback (name, content);
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-// ExecutorClosure::ExecutorClosure(const Closure &closure, ExecutorPtr executor)
-//   : Closure(closure.m_dataCallback, closure.m_timeoutCallback)
-//   , m_executor(executor)
-// {
-// }
-
-// ExecutorClosure::~ExecutorClosure()
-// {
-// }
-
-// void
-// ExecutorClosure::runDataCallback(Name name, PcoPtr content)
-// {
-//   m_executor->execute(boost::bind(&Closure::runDataCallback, this, name, content));
-// }
-
-// // void
-// // ExecutorClosure::execute(Name name, PcoPtr content)
-// // {
-// //   Closure::runDataCallback(name, content);
-// // }
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-// ExecutorInterestClosure::ExecutorInterestClosure(const InterestCallback &callback, ExecutorPtr executor)
-//   : m_callback(callback)
-//   , m_executor(executor)
-// {
-// }
-
-// void
-// ExecutorInterestClosure::runInterestCallback(Name interest)
-// {
-//   m_executor->execute(boost::bind(&ExecutorInterestClosure::execute, this, interest));
-// }
-
-// void
-// ExecutorInterestClosure::execute(Name interest)
-// {
-//   if (!m_callback.empty())
-//   {
-//     m_callback(interest);
-//   }
-// }
-
-} // Ndnx
diff --git a/ndnx/ndnx-closure.h b/ndnx/ndnx-closure.h
deleted file mode 100644
index 91e723a..0000000
--- a/ndnx/ndnx-closure.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_CLOSURE_H
-#define NDNX_CLOSURE_H
-
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-#include "ndnx-selectors.h"
-#include "executor.h"
-
-namespace Ndnx {
-
-class ParsedContentObject;
-typedef boost::shared_ptr<ParsedContentObject> PcoPtr;
-
-class Closure
-{
-public:
-  typedef boost::function<void (Name, PcoPtr pco)> DataCallback;
-
-  typedef boost::function<void (Name, const Closure &, Selectors)> TimeoutCallback;
-
-  Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback = TimeoutCallback());
-  virtual ~Closure();
-
-  virtual void
-  runDataCallback(Name name, Ndnx::PcoPtr pco);
-
-  virtual void
-  runTimeoutCallback(Name interest, const Closure &closure, Selectors selectors);
-
-  virtual Closure *
-  dup () const { return new Closure (*this); }
-
-public:
-  TimeoutCallback m_timeoutCallback;
-  DataCallback m_dataCallback;
-};
-
-// class ExecutorClosure : public Closure
-// {
-// public:
-//   ExecutorClosure(const Closure &closure, ExecutorPtr executor);
-//   virtual ~ExecutorClosure();
-
-//   virtual void
-//   runDataCallback(Name name, PcoPtr pco);
-
-// // private:
-// //   void
-// //   execute(Name nae, PcoPtr content);
-
-// private:
-//   ExecutorPtr m_executor;
-// };
-
-// class ExecutorInterestClosure
-// {
-// public:
-//   typedef boost::function<void (Name)> InterestCallback;
-//   ExecutorInterestClosure(const InterestCallback &callback, ExecutorPtr executor);
-//   virtual ~ExecutorInterestClosure() {}
-
-//   void
-//   runInterestCallback(Name interest);
-
-//   void
-//   execute(Name interest);
-
-// private:
-//   InterestCallback m_callback;
-//   ExecutorPtr m_executor;
-// };
-
-} // Ndnx
-
-#endif
diff --git a/ndnx/ndnx-common.h b/ndnx/ndnx-common.h
deleted file mode 100644
index fae1569..0000000
--- a/ndnx/ndnx-common.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_COMMON_H
-#define NDNX_COMMON_H
-
-extern "C" {
-#include <ndn/ndn.h>
-#include <ndn/charbuf.h>
-#include <ndn/keystore.h>
-#include <ndn/uri.h>
-#include <ndn/bloom.h>
-#include <ndn/signing.h>
-}
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <boost/exception/all.hpp>
-#include <boost/function.hpp>
-#include <string>
-#include <sstream>
-#include <map>
-#include <utility>
-#include <string.h>
-#include <boost/iostreams/filter/gzip.hpp>
-#include <boost/iostreams/filtering_stream.hpp>
-#include <boost/iostreams/device/back_inserter.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <boost/make_shared.hpp>
-
-namespace io = boost::iostreams;
-
-namespace Ndnx {
-typedef std::vector<unsigned char> Bytes;
-typedef std::vector<std::string>Comps;
-
-typedef boost::shared_ptr<Bytes> BytesPtr;
-
-inline
-const unsigned char *
-head(const Bytes &bytes)
-{
-  return &bytes[0];
-}
-
-inline
-unsigned char *
-head (Bytes &bytes)
-{
-  return &bytes[0];
-}
-
-// --- Bytes operations start ---
-inline void
-readRaw(Bytes &bytes, const unsigned char *src, size_t len)
-{
-  if (len > 0)
-  {
-    bytes.resize(len);
-    memcpy (head (bytes), src, len);
-  }
-}
-
-inline BytesPtr
-readRawPtr (const unsigned char *src, size_t len)
-{
-  if (len > 0)
-    {
-      BytesPtr ret (new Bytes (len));
-      memcpy (head (*ret), src, len);
-
-      return ret;
-    }
-  else
-    return BytesPtr ();
-}
-
-template<class Msg>
-BytesPtr
-serializeMsg(const Msg &msg)
-{
-  int size = msg.ByteSize ();
-  BytesPtr bytes (new Bytes (size));
-  msg.SerializeToArray (head(*bytes), size);
-  return bytes;
-}
-
-template<class Msg>
-boost::shared_ptr<Msg>
-deserializeMsg (const Bytes &bytes)
-{
-  boost::shared_ptr<Msg> retval (new Msg ());
-  if (!retval->ParseFromArray (head (bytes), bytes.size ()))
-    {
-      // to indicate an error
-      return boost::shared_ptr<Msg> ();
-    }
-  return retval;
-}
-
-template<class Msg>
-boost::shared_ptr<Msg>
-deserializeMsg (const void *buf, size_t length)
-{
-  boost::shared_ptr<Msg> retval (new Msg ());
-  if (!retval->ParseFromArray (buf, length))
-    {
-      // to indicate an error
-      return boost::shared_ptr<Msg> ();
-    }
-  return retval;
-}
-
-
-template<class Msg>
-BytesPtr
-serializeGZipMsg(const Msg &msg)
-{
-  std::vector<char> bytes;   // Bytes couldn't work
-  {
-    boost::iostreams::filtering_ostream out;
-    out.push(boost::iostreams::gzip_compressor()); // gzip filter
-    out.push(boost::iostreams::back_inserter(bytes)); // back_inserter sink
-
-    msg.SerializeToOstream(&out);
-  }
-  BytesPtr uBytes = boost::make_shared<Bytes>(bytes.size());
-  memcpy(&(*uBytes)[0], &bytes[0], bytes.size());
-  return uBytes;
-}
-
-template<class Msg>
-boost::shared_ptr<Msg>
-deserializeGZipMsg(const Bytes &bytes)
-{
-  std::vector<char> sBytes(bytes.size());
-  memcpy(&sBytes[0], &bytes[0], bytes.size());
-  boost::iostreams::filtering_istream in;
-  in.push(boost::iostreams::gzip_decompressor()); // gzip filter
-  in.push(boost::make_iterator_range(sBytes)); // source
-
-  boost::shared_ptr<Msg> retval = boost::make_shared<Msg>();
-  if (!retval->ParseFromIstream(&in))
-    {
-      // to indicate an error
-      return boost::shared_ptr<Msg> ();
-    }
-
-  return retval;
-}
-
-
-// --- Bytes operations end ---
-
-// Exceptions
-typedef boost::error_info<struct tag_errmsg, std::string> error_info_str;
-
-} // Ndnx
-#endif // NDNX_COMMON_H
diff --git a/ndnx/ndnx-discovery.cpp b/ndnx/ndnx-discovery.cpp
deleted file mode 100644
index dce0d98..0000000
--- a/ndnx/ndnx-discovery.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "ndnx-discovery.h"
-#include "simple-interval-generator.h"
-#include "task.h"
-#include "periodic-task.h"
-#include <sstream>
-#include <boost/make_shared.hpp>
-#include <boost/bind.hpp>
-
-using namespace Ndnx;
-using namespace std;
-
-const string
-TaggedFunction::CHAR_SET = string("abcdefghijklmnopqtrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
-
-TaggedFunction::TaggedFunction(const Callback &callback, const string &tag)
-                   : m_callback(callback)
-                   , m_tag(tag)
-{
-}
-
-string
-TaggedFunction::GetRandomTag()
-{
-  //boost::random::random_device rng;
-  //boost::random::uniform_int_distribution<> dist(0, CHAR_SET.size() - 1);
-  ostringstream oss;
-  //for (int i = 0; i < DEFAULT_TAG_SIZE; i++)
-  //{
-    //oss << CHAR_SET[dist(rng)];
-  //}
-  return oss.str();
-}
-
-void
-TaggedFunction::operator()(const Name &name)
-{
-  if (!m_callback.empty())
-  {
-    m_callback(name);
-  }
-}
-
-const double
-NdnxDiscovery::INTERVAL = 15.0;
-
-NdnxDiscovery *
-NdnxDiscovery::instance = NULL;
-
-boost::mutex
-NdnxDiscovery::mutex;
-
-NdnxDiscovery::NdnxDiscovery()
-              : m_scheduler(new Scheduler())
-              , m_localPrefix("/")
-{
-  m_scheduler->start();
-
-  Scheduler::scheduleOneTimeTask (m_scheduler, 0,
-                                  boost::bind(&NdnxDiscovery::poll, this), "Initial-Local-Prefix-Check");
-  Scheduler::schedulePeriodicTask (m_scheduler,
-                                   boost::make_shared<SimpleIntervalGenerator>(INTERVAL),
-                                   boost::bind(&NdnxDiscovery::poll, this), "Local-Prefix-Check");
-}
-
-NdnxDiscovery::~NdnxDiscovery()
-{
-  m_scheduler->shutdown();
-}
-
-void
-NdnxDiscovery::addCallback(const TaggedFunction &callback)
-{
-  m_callbacks.push_back(callback);
-}
-
-int
-NdnxDiscovery::deleteCallback(const TaggedFunction &callback)
-{
-  List::iterator it = m_callbacks.begin();
-  while (it != m_callbacks.end())
-  {
-    if ((*it) == callback)
-    {
-      it = m_callbacks.erase(it);
-    }
-    else
-    {
-      ++it;
-    }
-  }
-  return m_callbacks.size();
-}
-
-void
-NdnxDiscovery::poll()
-{
-  Name localPrefix = NdnxWrapper::getLocalPrefix();
-  if (localPrefix != m_localPrefix)
-  {
-    Lock lock(mutex);
-    for (List::iterator it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
-    {
-      (*it)(localPrefix);
-    }
-    m_localPrefix = localPrefix;
-  }
-}
-
-void
-NdnxDiscovery::registerCallback(const TaggedFunction &callback)
-{
-  Lock lock(mutex);
-  if (instance == NULL)
-  {
-    instance = new NdnxDiscovery();
-  }
-
-  instance->addCallback(callback);
-}
-
-void
-NdnxDiscovery::deregisterCallback(const TaggedFunction &callback)
-{
-  Lock lock(mutex);
-  if (instance == NULL)
-  {
-    cerr << "NdnxDiscovery::deregisterCallback called without instance" << endl;
-  }
-  else
-  {
-    int size = instance->deleteCallback(callback);
-    if (size == 0)
-    {
-      delete instance;
-      instance = NULL;
-    }
-  }
-}
-
diff --git a/ndnx/ndnx-discovery.h b/ndnx/ndnx-discovery.h
deleted file mode 100644
index e273364..0000000
--- a/ndnx/ndnx-discovery.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_DISCOVERY_H
-#define NDNX_DISCOVERY_H
-
-#include "ndnx-wrapper.h"
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-#include "scheduler.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/function.hpp>
-#include <boost/random.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/locks.hpp>
-#include <list>
-
-namespace Ndnx
-{
-
-class NdnxDiscovery;
-typedef boost::shared_ptr<NdnxDiscovery> NdnxDiscoveryPtr;
-
-class TaggedFunction
-{
-public:
-  typedef boost::function<void (const Name &)> Callback;
-  TaggedFunction(const Callback &callback, const string &tag = GetRandomTag());
-  ~TaggedFunction(){};
-
-  bool
-  operator==(const TaggedFunction &other) { return m_tag == other.m_tag; }
-
-  void
-  operator()(const Name &name);
-
-private:
-  static const std::string CHAR_SET;
-  static const int DEFAULT_TAG_SIZE = 32;
-
-  static std::string
-  GetRandomTag();
-
-private:
-  Callback m_callback;
-  std::string m_tag;
-};
-
-class NdnxDiscovery
-{
-public:
-  const static double INTERVAL;
-  // Add a callback to be invoked when local prefix changes
-  // you must remember to deregister the callback
-  // otherwise you may have undefined behavior if the callback is
-  // bind to a member function of an object and the object is deleted
-  static void
-  registerCallback(const TaggedFunction &callback);
-
-  // remember to call this before you quit
-  static void
-  deregisterCallback(const TaggedFunction &callback);
-
-private:
-  NdnxDiscovery();
-  ~NdnxDiscovery();
-
-  void
-  poll();
-
-  void
-  addCallback(const TaggedFunction &callback);
-
-  int
-  deleteCallback(const TaggedFunction &callback);
-
-private:
-  typedef boost::mutex Mutex;
-  typedef boost::unique_lock<Mutex> Lock;
-  typedef std::list<TaggedFunction> List;
-
-  static NdnxDiscovery *instance;
-  static Mutex mutex;
-  List m_callbacks;
-  SchedulerPtr m_scheduler;
-  Name m_localPrefix;
-};
-
-} // Ndnx
-#endif // NDNX_DISCOVERY_H
diff --git a/ndnx/ndnx-name.cpp b/ndnx/ndnx-name.cpp
deleted file mode 100644
index dcf762e..0000000
--- a/ndnx/ndnx-name.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-name.h"
-#include <boost/lexical_cast.hpp>
-#include <ctype.h>
-#include <boost/algorithm/string/join.hpp>
-#include <boost/make_shared.hpp>
-
-using namespace std;
-
-namespace Ndnx{
-
-Name::Name()
-{
-}
-
-Name::Name(const string &name)
-{
-  stringstream ss(name);
-  string compStr;
-  bool first = true;
-  while(getline(ss, compStr, '/'))
-  {
-    // discard the first empty comp before the first '/'
-    if (first)
-    {
-      first = false;
-      continue;
-    }
-    Bytes comp(compStr.begin(), compStr.end());
-    m_comps.push_back(comp);
-  }
-}
-
-Name::Name(const vector<Bytes> &comps)
-{
-  m_comps = comps;
-}
-
-Name::Name(const Name &other)
-{
-  m_comps = other.m_comps;
-}
-
-Name::Name(const unsigned char *data, const ndn_indexbuf *comps)
-{
-  for (unsigned int i = 0; i < comps->n - 1; i++)
-  {
-    const unsigned char *compPtr;
-    size_t size;
-    ndn_name_comp_get(data, comps, i, &compPtr, &size);
-    Bytes comp;
-    readRaw(comp, compPtr, size);
-    m_comps.push_back(comp);
-  }
-}
-
-Name::Name (const void *buf, const size_t length)
-{
-  ndn_indexbuf *idx = ndn_indexbuf_create();
-  const ndn_charbuf namebuf = { length, length, const_cast<unsigned char *> (reinterpret_cast<const unsigned char *> (buf)) };
-  ndn_name_split (&namebuf, idx);
-
-  const unsigned char *compPtr = NULL;
-  size_t size = 0;
-  int i = 0;
-  while (ndn_name_comp_get(namebuf.buf, idx, i, &compPtr, &size) == 0)
-    {
-      Bytes comp;
-      readRaw (comp, compPtr, size);
-      m_comps.push_back(comp);
-      i++;
-    }
-  ndn_indexbuf_destroy(&idx);
-}
-
-Name::Name (const NdnxCharbuf &buf)
-{
-  ndn_indexbuf *idx = ndn_indexbuf_create();
-  ndn_name_split (buf.getBuf (), idx);
-
-  const unsigned char *compPtr = NULL;
-  size_t size = 0;
-  int i = 0;
-  while (ndn_name_comp_get(buf.getBuf ()->buf, idx, i, &compPtr, &size) == 0)
-    {
-      Bytes comp;
-      readRaw (comp, compPtr, size);
-      m_comps.push_back(comp);
-      i++;
-    }
-  ndn_indexbuf_destroy(&idx);
-}
-
-Name::Name (const ndn_charbuf *buf)
-{
-  ndn_indexbuf *idx = ndn_indexbuf_create();
-  ndn_name_split (buf, idx);
-
-  const unsigned char *compPtr = NULL;
-  size_t size = 0;
-  int i = 0;
-  while (ndn_name_comp_get(buf->buf, idx, i, &compPtr, &size) == 0)
-    {
-      Bytes comp;
-      readRaw (comp, compPtr, size);
-      m_comps.push_back(comp);
-      i++;
-    }
-  ndn_indexbuf_destroy(&idx);
-}
-
-Name &
-Name::operator=(const Name &other)
-{
-  m_comps = other.m_comps;
-  return *this;
-}
-bool
-Name::operator==(const string &str) const
-{
-  return this->toString() == str;
-}
-
-bool
-Name::operator!=(const string &str) const
-{
-  return !(*this == str);
-}
-
-Name
-operator+(const Name &n1, const Name &n2)
-{
-  vector<Bytes> comps = n1.m_comps;
-  copy(n2.m_comps.begin(), n2.m_comps.end(), back_inserter(comps));
-  return Name(comps);
-}
-
-string
-Name::toString() const
-{
-  stringstream ss(stringstream::out);
-  ss << *this;
-  return ss.str();
-}
-
-NdnxCharbuf*
-Name::toNdnxCharbufRaw () const
-{
-  NdnxCharbuf *ptr = new NdnxCharbuf ();
-
-  ndn_charbuf *cbuf = ptr->getBuf();
-  ndn_name_init(cbuf);
-  int size = m_comps.size();
-  for (int i = 0; i < size; i++)
-  {
-    ndn_name_append(cbuf, head(m_comps[i]), m_comps[i].size());
-  }
-  return ptr;
-}
-
-
-NdnxCharbufPtr
-Name::toNdnxCharbuf () const
-{
-  return NdnxCharbufPtr (toNdnxCharbufRaw ());
-}
-
-Name &
-Name::appendComp(const Name &comp)
-{
-  m_comps.insert (m_comps.end (),
-                  comp.m_comps.begin (), comp.m_comps.end ());
-  return *this;
-}
-
-Name &
-Name::appendComp(const Bytes &comp)
-{
-  m_comps.push_back(comp);
-  return *this;
-}
-
-Name &
-Name::appendComp(const string &compStr)
-{
-  Bytes comp(compStr.begin(), compStr.end());
-  return appendComp(comp);
-}
-
-Name &
-Name::appendComp (const void *buf, size_t size)
-{
-  Bytes comp (reinterpret_cast<const unsigned char*> (buf), reinterpret_cast<const unsigned char*> (buf) + size);
-  return appendComp(comp);
-}
-
-Name &
-Name::appendComp(uint64_t number)
-{
-  Bytes comp;
-  comp.push_back (0);
-
-  while (number > 0)
-    {
-      comp.push_back (static_cast<unsigned char> (number & 0xFF));
-      number >>= 8;
-    }
-  return appendComp (comp);
-}
-
-uint64_t
-Name::getCompAsInt (int index) const
-{
-  Bytes comp = getComp(index);
-  if (comp.size () < 1 ||
-      comp[0] != 0)
-    {
-      boost::throw_exception(NameException()
-                             << error_info_str("Non integer component: " + getCompAsString(index)));
-    }
-  uint64_t ret = 0;
-  for (int i = comp.size () - 1; i >= 1; i--)
-    {
-      ret <<= 8;
-      ret |= comp [i];
-    }
-  return ret;
-}
-
-const Bytes &
-Name::getComp(int index) const
-{
-  if (index < 0)
-    {
-      boost::throw_exception(NameException() << error_info_str("Negative index: " + boost::lexical_cast<string>(index)));
-    }
-
-  if (static_cast<unsigned int> (index) >= m_comps.size())
-    {
-      boost::throw_exception(NameException() << error_info_str("Index out of range: " + boost::lexical_cast<string>(index)));
-    }
-  return m_comps[index];
-}
-
-string
-Name::getCompAsString(int index) const
-{
-  Bytes comp = getComp(index);
-  stringstream ss(stringstream::out);
-  int size = comp.size();
-  for (int i = 0; i < size; i++)
-  {
-    unsigned char ch = comp[i];
-    if (isprint(ch))
-    {
-      ss << (char) ch;
-    }
-    else
-    {
-      ss << "%" << hex << setfill('0') << setw(2) << (unsigned int)ch;
-    }
-  }
-
-  return ss.str();
-}
-
-Name
-Name::getPartialName(int start, int n) const
-{
-  int size = m_comps.size();
-  if (start < 0 || start >= size || (n > 0 && start + n > size))
-  {
-    stringstream ss(stringstream::out);
-    ss << "getPartialName() parameter out of range! ";
-    ss << "start = " << start;
-    ss << "n = " << n;
-    ss << "size = " << size;
-    boost::throw_exception(NameException() << error_info_str(ss.str()));
-  }
-
-  vector<Bytes> comps;
-  int end;
-  if (n > 0)
-  {
-    end = start + n;
-  }
-  else
-  {
-    end = size;
-  }
-
-  for (int i = start; i < end; i++)
-  {
-    comps.push_back(m_comps[i]);
-  }
-
-  return Name(comps);
-}
-
-ostream &
-operator <<(ostream &os, const Name &name)
-{
-  int size = name.size();
-  vector<string> strComps;
-  for (int i = 0; i < size; i++)
-  {
-    strComps.push_back(name.getCompAsString(i));
-  }
-  string joined = boost::algorithm::join(strComps, "/");
-  os << "/" << joined;
-  return os;
-}
-
-bool
-operator ==(const Name &n1, const Name &n2)
-{
-  stringstream ss1(stringstream::out);
-  stringstream ss2(stringstream::out);
-  ss1 << n1;
-  ss2 << n2;
-  return ss1.str() == ss2.str();
-}
-
-bool
-operator !=(const Name &n1, const Name &n2)
-{
-  return !(n1 == n2);
-}
-
-bool
-operator <(const Name &n1, const Name &n2)
-{
-  stringstream ss1(stringstream::out);
-  stringstream ss2(stringstream::out);
-  ss1 << n1;
-  ss2 << n2;
-  return ss1.str() < ss2.str();
-}
-
-
-} // Ndnx
diff --git a/ndnx/ndnx-name.h b/ndnx/ndnx-name.h
deleted file mode 100644
index 2fde71b..0000000
--- a/ndnx/ndnx-name.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_NAME_H
-#define NDNX_NAME_H
-#include <boost/shared_ptr.hpp>
-#include "ndnx-common.h"
-#include "ndnx-charbuf.h"
-
-namespace Ndnx {
-
-struct NameException:
-    virtual boost::exception, virtual std::exception {};
-
-class Name
-{
-public:
-  Name();
-  Name(const std::string &name);
-  Name(const std::vector<Bytes> &comps);
-  Name(const Name &other);
-  Name(const unsigned char *data, const ndn_indexbuf *comps);
-  Name (const void *buf, const size_t length);
-  Name (const NdnxCharbuf &buf);
-  Name (const ndn_charbuf *buf);
-  virtual ~Name() {}
-
-  NdnxCharbufPtr
-  toNdnxCharbuf() const;
-
-  NdnxCharbuf*
-  toNdnxCharbufRaw () const;
-
-  operator NdnxCharbufPtr () const { return toNdnxCharbuf (); }
-
-  Name &
-  appendComp(const Name &comp);
-
-  Name &
-  appendComp(const Bytes &comp);
-
-  Name &
-  appendComp(const std::string &compStr);
-
-  Name &
-  appendComp(const void *buf, size_t size);
-
-  /**
-   * Append int component
-   *
-   * Difference between this and appendComp call is that data is appended in network order
-   *
-   * Also, this function honors naming convention (%00 prefix is added)
-   */
-  Name &
-  appendComp(uint64_t number);
-
-  template<class T>
-  Name &
-  operator ()(const T &comp) { return appendComp (comp); }
-
-  Name &
-  operator ()(const void *buf, size_t size) { return appendComp (buf, size); }
-
-  int
-  size() const {return m_comps.size();}
-
-  const Bytes &
-  getComp (int index) const;
-
-  inline const Bytes &
-  getCompFromBack (int index) const;
-
-  // return std::string format of the comp
-  // if all characters are printable, simply returns the string
-  // if not, print the bytes in hex string format
-  std::string
-  getCompAsString(int index) const;
-
-  uint64_t
-  getCompAsInt (int index) const;
-
-  inline std::string
-  getCompFromBackAsString(int index) const;
-
-  inline uint64_t
-  getCompFromBackAsInt (int index) const;
-
-  Name
-  getPartialName(int start, int n = -1) const;
-
-  inline Name
-  getPartialNameFromBack(int start, int n = -1) const;
-
-  std::string
-  toString() const;
-
-  Name &
-  operator=(const Name &other);
-
-  bool
-  operator==(const std::string &str) const;
-
-  bool
-  operator!=(const std::string &str) const;
-
-  friend Name
-  operator+(const Name &n1, const Name &n2);
-
-private:
-  std::vector<Bytes> m_comps;
-};
-
-typedef boost::shared_ptr<Name> NamePtr;
-
-std::ostream&
-operator <<(std::ostream &os, const Name &name);
-
-bool
-operator ==(const Name &n1, const Name &n2);
-
-bool
-operator !=(const Name &n1, const Name &n2);
-
-bool
-operator <(const Name &n1, const Name &n2);
-
-
-std::string
-Name::getCompFromBackAsString(int index) const
-{
-  return getCompAsString (m_comps.size () - 1 - index);
-}
-
-uint64_t
-Name::getCompFromBackAsInt (int index) const
-{
-  return getCompAsInt (m_comps.size () - 1 - index);
-}
-
-Name
-Name::getPartialNameFromBack(int start, int n/* = -1*/) const
-{
-  return getPartialName (m_comps.size () - 1 - start, n);
-}
-
-const Bytes &
-Name::getCompFromBack (int index) const
-{
-  return getComp (m_comps.size () - 1 - index);
-}
-
-
-} // Ndnx
-#endif
diff --git a/ndnx/ndnx-pco.cpp b/ndnx/ndnx-pco.cpp
deleted file mode 100644
index 01c78da..0000000
--- a/ndnx/ndnx-pco.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-pco.h"
-#include "ndnx-cert.h"
-#include "hash-helper.h"
-
-namespace Ndnx {
-
-void
-ParsedContentObject::init(const unsigned char *data, size_t len)
-{
-  readRaw(m_bytes, data, len);
-
-  m_comps = ndn_indexbuf_create();
-  int res = ndn_parse_ContentObject(head (m_bytes), len, &m_pco, m_comps);
-  if (res < 0)
-  {
-    boost::throw_exception(MisformedContentObjectException());
-  }
-
-}
-
-ParsedContentObject::ParsedContentObject(const unsigned char *data, size_t len, bool verified)
-            : m_comps(NULL)
-            , m_verified(verified)
-{
-  init(data, len);
-}
-
-ParsedContentObject::ParsedContentObject(const Bytes &bytes, bool verified)
-            : m_comps(NULL)
-            , m_verified(verified)
-{
-  init(head(bytes), bytes.size());
-}
-
-ParsedContentObject::ParsedContentObject(const ParsedContentObject &other, bool verified)
-            : m_comps(NULL)
-            , m_verified(verified)
-{
-  init(head(other.m_bytes), other.m_bytes.size());
-}
-
-ParsedContentObject::~ParsedContentObject()
-{
-  ndn_indexbuf_destroy(&m_comps);
-  m_comps = NULL;
-}
-
-Bytes
-ParsedContentObject::content() const
-{
-  const unsigned char *content;
-  size_t len;
-  int res = ndn_content_get_value(head(m_bytes), m_pco.offset[NDN_PCO_E], &m_pco, &content, &len);
-  if (res < 0)
-  {
-    boost::throw_exception(MisformedContentObjectException());
-  }
-
-  Bytes bytes;
-  readRaw(bytes, content, len);
-  return bytes;
-}
-
-BytesPtr
-ParsedContentObject::contentPtr() const
-{
-  const unsigned char *content;
-  size_t len;
-  int res = ndn_content_get_value(head(m_bytes), m_pco.offset[NDN_PCO_E], &m_pco, &content, &len);
-  if (res < 0)
-  {
-    boost::throw_exception(MisformedContentObjectException());
-  }
-
-  return readRawPtr (content, len);
-}
-
-Name
-ParsedContentObject::name() const
-{
-  return Name(head(m_bytes), m_comps);
-}
-
-Name
-ParsedContentObject::keyName() const
-{
-  if (m_pco.offset[NDN_PCO_E_KeyName_Name] > m_pco.offset[NDN_PCO_B_KeyName_Name])
-  {
-    NdnxCharbufPtr ptr = boost::make_shared<NdnxCharbuf>();
-    ndn_charbuf_append(ptr->getBuf(), head(m_bytes) + m_pco.offset[NDN_PCO_B_KeyName_Name], m_pco.offset[NDN_PCO_E_KeyName_Name] - m_pco.offset[NDN_PCO_B_KeyName_Name]);
-
-    return Name(*ptr);
-}
-  else
-  {
-    return Name();
-  }
-}
-
-HashPtr
-ParsedContentObject::publisherPublicKeyDigest() const
-{
-  const unsigned char *buf = NULL;
-  size_t size = 0;
-  ndn_ref_tagged_BLOB(NDN_DTAG_PublisherPublicKeyDigest, head(m_bytes), m_pco.offset[NDN_PCO_B_PublisherPublicKeyDigest], m_pco.offset[NDN_PCO_E_PublisherPublicKeyDigest], &buf, &size);
-
-  return boost::make_shared<Hash>(buf, size);
-}
-
-ParsedContentObject::Type
-ParsedContentObject::type() const
-{
-  switch (m_pco.type)
-  {
-  case NDN_CONTENT_DATA: return DATA;
-  case NDN_CONTENT_KEY: return KEY;
-  default: break;
-  }
-  return OTHER;
-}
-
-void
-ParsedContentObject::verifySignature(const CertPtr &cert)
-{
-  m_verified = (ndn_verify_signature(head(m_bytes), m_pco.offset[NDN_PCO_E], &m_pco, cert->pkey()) == 1);
-}
-
-}
diff --git a/ndnx/ndnx-pco.h b/ndnx/ndnx-pco.h
deleted file mode 100644
index 6af0f73..0000000
--- a/ndnx/ndnx-pco.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_CONTENT_OBJECT_H
-#define NDNX_CONTENT_OBJECT_H
-
-#include "ndnx-wrapper.h"
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-
-class Hash;
-typedef boost::shared_ptr<Hash> HashPtr;
-
-namespace Ndnx {
-
-struct MisformedContentObjectException : virtual boost::exception, virtual std::exception { };
-
-class Cert;
-typedef boost::shared_ptr<Cert> CertPtr;
-
-class ParsedContentObject
-{
-public:
-  enum Type
-  {
-    DATA,
-    KEY,
-    OTHER
-  };
-  ParsedContentObject(const unsigned char *data, size_t len, bool verified = false);
-  ParsedContentObject(const unsigned char *data, const ndn_parsed_ContentObject &pco, bool verified = false);
-  ParsedContentObject(const Bytes &bytes, bool verified = false);
-  ParsedContentObject(const ParsedContentObject &other, bool verified = false);
-  virtual ~ParsedContentObject();
-
-  Bytes
-  content() const;
-
-  BytesPtr
-  contentPtr() const;
-
-  Name
-  name() const;
-
-  Name
-  keyName() const;
-
-  HashPtr
-  publisherPublicKeyDigest() const;
-
-  Type
-  type() const;
-
-  inline const Bytes &
-  buf () const;
-
-  bool
-  verified() const { return m_verified; }
-
-  void
-  verifySignature(const CertPtr &cert);
-
-  const unsigned char *
-  msg() const { return head(m_bytes); }
-
-  const ndn_parsed_ContentObject *
-  pco() const { return &m_pco; }
-
-private:
-  void
-  init(const unsigned char *data, size_t len);
-
-protected:
-  ndn_parsed_ContentObject m_pco;
-  ndn_indexbuf *m_comps;
-  Bytes m_bytes;
-  bool m_verified;
-  bool m_integrityChecked;
-};
-
-const Bytes &
-ParsedContentObject::buf () const
-{
-  return m_bytes;
-}
-
-
-typedef boost::shared_ptr<ParsedContentObject> PcoPtr;
-
-}
-
-#endif // NDNX_CONTENT_OBJECT_H
diff --git a/ndnx/ndnx-selectors.cpp b/ndnx/ndnx-selectors.cpp
deleted file mode 100644
index 3006d0e..0000000
--- a/ndnx/ndnx-selectors.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "ndnx-selectors.h"
-#include "ndnx-common.h"
-#include <boost/lexical_cast.hpp>
-
-using namespace std;
-
-namespace Ndnx {
-
-Selectors::Selectors()
-          : m_maxSuffixComps(-1)
-          , m_minSuffixComps(-1)
-          , m_answerOriginKind(AOK_DEFAULT)
-          , m_interestLifetime(-1.0)
-          , m_scope(NO_SCOPE)
-          , m_childSelector(DEFAULT)
-{
-}
-
-Selectors::Selectors(const Selectors &other)
-{
-  m_maxSuffixComps = other.m_maxSuffixComps;
-  m_minSuffixComps = other.m_minSuffixComps;
-  m_answerOriginKind = other.m_answerOriginKind;
-  m_interestLifetime = other.m_interestLifetime;
-  m_scope = other.m_scope;
-  m_childSelector = other.m_childSelector;
-  m_publisherPublicKeyDigest = other.m_publisherPublicKeyDigest;
-}
-
-Selectors::Selectors(const ndn_parsed_interest *pi)
-          : m_maxSuffixComps(-1)
-          , m_minSuffixComps(-1)
-          , m_answerOriginKind(AOK_DEFAULT)
-          , m_interestLifetime(-1.0)
-          , m_scope(NO_SCOPE)
-          , m_childSelector(DEFAULT)
-{
-  if (pi != NULL)
-  {
-    m_maxSuffixComps = pi->max_suffix_comps;
-    m_minSuffixComps = pi->min_suffix_comps;
-    switch(pi->orderpref)
-    {
-      case 0: m_childSelector = LEFT; break;
-      case 1: m_childSelector = RIGHT; break;
-      default: break;
-    }
-    switch(pi->answerfrom)
-    {
-      case 0x1: m_answerOriginKind = AOK_CS; break;
-      case 0x2: m_answerOriginKind = AOK_NEW; break;
-      case 0x3: m_answerOriginKind = AOK_DEFAULT; break;
-      case 0x4: m_answerOriginKind = AOK_STALE; break;
-      case 0x10: m_answerOriginKind = AOK_EXPIRE; break;
-      default: break;
-    }
-    m_scope = static_cast<Scope> (pi->scope);
-    // scope and interest lifetime do not really matter to receiving application, it's only meaningful to routers
-  }
-}
-
-bool
-Selectors::operator == (const Selectors &other)
-{
-  return m_maxSuffixComps == other.m_maxSuffixComps
-         && m_minSuffixComps == other.m_minSuffixComps
-         && m_answerOriginKind == other.m_answerOriginKind
-         && (m_interestLifetime - other.m_interestLifetime) < 10e-4
-         && m_scope == other.m_scope
-         && m_childSelector == other.m_childSelector;
-}
-
-bool
-Selectors::isEmpty() const
-{
-  return m_maxSuffixComps == -1
-         && m_minSuffixComps == -1
-         && m_answerOriginKind == AOK_DEFAULT
-         && (m_interestLifetime - (-1.0)) < 10e-4
-         && m_scope == NO_SCOPE
-         && m_childSelector == DEFAULT;
-}
-
-
-NdnxCharbufPtr
-Selectors::toNdnxCharbuf() const
-{
-  if (isEmpty())
-  {
-    return NdnxCharbufPtr ();
-  }
-  NdnxCharbufPtr ptr(new NdnxCharbuf());
-  ndn_charbuf *cbuf = ptr->getBuf();
-  ndn_charbuf_append_tt(cbuf, NDN_DTAG_Interest, NDN_DTAG);
-  ndn_charbuf_append_tt(cbuf, NDN_DTAG_Name, NDN_DTAG);
-  ndn_charbuf_append_closer(cbuf); // </Name>
-
-  if (m_maxSuffixComps < m_minSuffixComps)
-  {
-    boost::throw_exception(InterestSelectorException() << error_info_str("MaxSuffixComps = " + boost::lexical_cast<string>(m_maxSuffixComps) + " is smaller than  MinSuffixComps = " + boost::lexical_cast<string>(m_minSuffixComps)));
-  }
-
-  if (m_minSuffixComps > 0)
-  {
-    ndnb_tagged_putf(cbuf, NDN_DTAG_MinSuffixComponents, "%d", m_minSuffixComps);
-  }
-
-  if (m_maxSuffixComps > 0)
-  {
-    ndnb_tagged_putf(cbuf, NDN_DTAG_MaxSuffixComponents, "%d", m_maxSuffixComps);
-  }
-
-  // publisher digest
-
-  // exclude
-
-  if (m_childSelector != DEFAULT)
-  {
-    ndnb_tagged_putf(cbuf, NDN_DTAG_MinSuffixComponents, "%d", (int)m_minSuffixComps);
-  }
-
-  if (m_answerOriginKind != AOK_DEFAULT)
-  {
-    // it was not using "ndnb_tagged_putf" in ndnx c code, no idea why
-    ndn_charbuf_append_tt(cbuf, NDN_DTAG_AnswerOriginKind, NDN_DTAG);
-    ndnb_append_number(cbuf, m_answerOriginKind);
-    ndn_charbuf_append_closer(cbuf); // <AnswerOriginKind>
-  }
-
-  if (m_scope != NO_SCOPE)
-  {
-    ndnb_tagged_putf(cbuf, NDN_DTAG_Scope, "%d", m_scope);
-  }
-
-  if (m_interestLifetime > 0.0)
-  {
-    // Ndnx timestamp unit is weird 1/4096 second
-    // this is from their code
-    unsigned lifetime = 4096 * (m_interestLifetime + 1.0/8192.0);
-    if (lifetime == 0 || lifetime > (30 << 12))
-    {
-      boost::throw_exception(InterestSelectorException() << error_info_str("Ndnx requires 0 < lifetime < 30.0. lifetime= " + boost::lexical_cast<string>(m_interestLifetime)));
-    }
-    unsigned char buf[3] = {0};
-    for (int i = sizeof(buf) - 1; i >= 0; i--, lifetime >>= 8)
-    {
-      buf[i] = lifetime & 0xff;
-    }
-    ndnb_append_tagged_blob(cbuf, NDN_DTAG_InterestLifetime, buf, sizeof(buf));
-  }
-
-  ndn_charbuf_append_closer(cbuf); // </Interest>
-
-  return ptr;
-}
-
-} // Ndnx
diff --git a/ndnx/ndnx-selectors.h b/ndnx/ndnx-selectors.h
deleted file mode 100644
index f75647d..0000000
--- a/ndnx/ndnx-selectors.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012-2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-#ifndef NDNX_SELECTORS_H
-#define NDNX_SELECTORS_H
-
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-
-namespace Ndnx {
-
-struct InterestSelectorException:
-    virtual boost::exception, virtual std::exception {};
-
-class Selectors
-{
-public:
-  Selectors();
-  Selectors(const ndn_parsed_interest *);
-  Selectors(const Selectors &other);
-  ~Selectors(){};
-
-  typedef enum
-  {
-    AOK_CS = 0x1,
-    AOK_NEW = 0x2,
-    AOK_DEFAULT = 0x3, // (AOK_CS | AOK_NEW)
-    AOK_STALE = 0x4,
-    AOK_EXPIRE = 0x10
-  } AOK;
-
-  typedef enum
-  {
-    LEFT = 0,
-    RIGHT = 1,
-    DEFAULT = 2
-  } CHILD_SELECTOR;
-
-  enum Scope
-    {
-      NO_SCOPE = -1,
-      SCOPE_LOCAL_NDND = 0,
-      SCOPE_LOCAL_HOST = 1,
-      SCOPE_NEXT_HOST = 2
-    };
-
-  inline Selectors &
-  maxSuffixComps(int maxSCs) {m_maxSuffixComps = maxSCs; return *this;}
-
-  inline Selectors &
-  minSuffixComps(int minSCs) {m_minSuffixComps = minSCs; return *this;}
-
-  inline Selectors &
-  answerOriginKind(AOK kind) {m_answerOriginKind = kind; return *this;}
-
-  inline Selectors &
-  interestLifetime(double lifetime) {m_interestLifetime = lifetime; return *this;}
-
-  inline Selectors &
-  scope(Scope scope) {m_scope = scope; return *this;}
-
-  inline Selectors &
-  childSelector(CHILD_SELECTOR child) {m_childSelector = child; return *this;}
-
-  // this has no effect now
-  inline Selectors &
-  publisherPublicKeyDigest(const Bytes &digest) {m_publisherPublicKeyDigest = digest; return *this;}
-
-  NdnxCharbufPtr
-  toNdnxCharbuf() const;
-
-  bool
-  isEmpty() const;
-
-  bool
-  operator==(const Selectors &other);
-
-private:
-  int m_maxSuffixComps;
-  int m_minSuffixComps;
-  AOK m_answerOriginKind;
-  double m_interestLifetime;
-  Scope m_scope;
-  CHILD_SELECTOR m_childSelector;
-  // not used now
-  Bytes m_publisherPublicKeyDigest;
-};
-
-} // Ndnx
-
-#endif
diff --git a/ndnx/ndnx-verifier.cpp b/ndnx/ndnx-verifier.cpp
deleted file mode 100644
index 1bcfad0..0000000
--- a/ndnx/ndnx-verifier.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-verifier.h"
-#include "ndnx-wrapper.h"
-
-INIT_LOGGER ("Ndnx.Verifier");
-namespace Ndnx {
-
-static const size_t ROOT_KEY_DIGEST_LEN = 32;  // SHA-256
-static const unsigned char ROOT_KEY_DIGEST[ROOT_KEY_DIGEST_LEN] = {0xa7, 0xd9, 0x8b, 0x81, 0xde, 0x13, 0xfc,
-0x56, 0xc5, 0xa6, 0x92, 0xb4, 0x44, 0x93, 0x6e, 0x56, 0x70, 0x9d, 0x52, 0x6f, 0x70,
-0xed, 0x39, 0xef, 0xb5, 0xe2, 0x3, 0x29, 0xa5, 0x53, 0x3e, 0x68};
-
-Verifier::Verifier(NdnxWrapper *ndnx)
-         : m_ndnx(ndnx)
-         , m_rootKeyDigest(ROOT_KEY_DIGEST, ROOT_KEY_DIGEST_LEN)
-{
-}
-
-Verifier::~Verifier()
-{
-}
-
-bool
-Verifier::verify(const PcoPtr &pco, double maxWait)
-{
-  _LOG_TRACE("Verifying content [" << pco->name() << "]");
-  HashPtr publisherPublicKeyDigest = pco->publisherPublicKeyDigest();
-
-  {
-    UniqueRecLock lock(m_cacheLock);
-    CertCache::iterator it = m_certCache.find(*publisherPublicKeyDigest);
-    if (it != m_certCache.end())
-    {
-      CertPtr cert = it->second;
-      if (cert->validity() == Cert::WITHIN_VALID_TIME_SPAN)
-      {
-        pco->verifySignature(cert);
-        return pco->verified();
-      }
-      else
-      {
-        // delete the invalid cert cache
-        m_certCache.erase(it);
-      }
-    }
-  }
-
-  // keyName is the name specified in key locator, i.e. without version and segment
-  Name keyName = pco->keyName();
-  int keyNameSize = keyName.size();
-
-  if (keyNameSize < 2)
-  {
-    _LOG_ERROR("Key name is empty or has too few components.");
-    return false;
-  }
-
-  // for keys, we have to make sure key name is strictly prefix of the content name
-  if (pco->type() == ParsedContentObject::KEY)
-  {
-    Name contentName = pco->name();
-    // when checking for prefix, do not include the hash in the key name (which is the last component)
-    Name keyNamePrefix = keyName.getPartialName(0, keyNameSize - 1);
-    if (keyNamePrefix.size() >= contentName.size() || contentName.getPartialName(0, keyNamePrefix.size()) != keyNamePrefix)
-    {
-      _LOG_ERROR("Key name prefix [" << keyNamePrefix << "] is not the prefix of content name [" << contentName << "]");
-      return false;
-    }
-  }
-  else
-  {
-    // for now, user can assign any data using his key
-  }
-
-  Name metaName = keyName.getPartialName(0, keyNameSize - 1) + Name("/info") + keyName.getPartialName(keyNameSize - 1);
-
-  Selectors selectors;
-
-  selectors.childSelector(Selectors::RIGHT)
-           .interestLifetime(maxWait);
-
-  PcoPtr keyObject = m_ndnx->get(keyName, selectors, maxWait);
-  PcoPtr metaObject = m_ndnx->get(metaName, selectors, maxWait);
-  if (!keyObject || !metaObject )
-  {
-    _LOG_ERROR("can not fetch key or meta");
-    return false;
-  }
-
-  HashPtr publisherKeyHashInKeyObject = keyObject->publisherPublicKeyDigest();
-  HashPtr publisherKeyHashInMetaObject = metaObject->publisherPublicKeyDigest();
-
-  // make sure key and meta are signed using the same key
-  if (publisherKeyHashInKeyObject->IsZero() || ! (*publisherKeyHashInKeyObject == *publisherKeyHashInMetaObject))
-  {
-    _LOG_ERROR("Key and Meta not signed by the same publisher");
-    return false;
-  }
-
-  CertPtr cert = boost::make_shared<Cert>(keyObject, metaObject);
-  if (cert->validity() != Cert::WITHIN_VALID_TIME_SPAN)
-  {
-    _LOG_ERROR("Certificate is not valid, validity status is : " << cert->validity());
-    return false;
-  }
-
-  // check pco is actually signed by this key (i.e. we don't trust the publisherPublicKeyDigest given by ndnx c lib)
-  if (! (*pco->publisherPublicKeyDigest() == cert->keyDigest()))
-  {
-    _LOG_ERROR("key digest does not match the publisher public key digest of the content object");
-    return false;
-  }
-
-  // now we only need to make sure the key is trustworthy
-  if (cert->keyDigest() == m_rootKeyDigest)
-  {
-    // the key is the root key
-    // do nothing now
-  }
-  else
-  {
-    // can not verify key or can not verify meta
-    if (!verify(keyObject, maxWait) || !verify(metaObject, maxWait))
-    {
-      _LOG_ERROR("Can not verify key or meta");
-      return false;
-    }
-  }
-
-  // ok, keyObject verified, because metaObject is signed by the same parent key and integrity checked
-  // so metaObject is also verified
-  {
-    UniqueRecLock lock(m_cacheLock);
-    m_certCache.insert(std::make_pair(cert->keyDigest(), cert));
-  }
-
-  pco->verifySignature(cert);
-  if (pco->verified())
-  {
-    _LOG_TRACE("[" << pco->name() << "] VERIFIED.");
-  }
-  else
-  {
-    _LOG_ERROR("[" << pco->name() << "] CANNOT BE VERIFIED.");
-  }
-  return pco->verified();
-}
-
-} // Ndnx
diff --git a/ndnx/ndnx-verifier.h b/ndnx/ndnx-verifier.h
deleted file mode 100644
index ce3d450..0000000
--- a/ndnx/ndnx-verifier.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_VERIFIER_H
-#define NDNX_VERIFIER_H
-
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-#include "ndnx-cert.h"
-#include "ndnx-pco.h"
-#include <map>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-#include <boost/thread/thread.hpp>
-
-namespace Ndnx {
-
-class NdnxWrapper;
-
-class Verifier
-{
-public:
-  Verifier(NdnxWrapper *ndnx);
-  ~Verifier();
-
-  bool verify(const PcoPtr &pco, double maxWait);
-
-private:
-
-private:
-  NdnxWrapper *m_ndnx;
-  Hash m_rootKeyDigest;
-  typedef std::map<Hash, CertPtr> CertCache;
-  CertCache m_certCache;
-  typedef boost::recursive_mutex RecLock;
-  typedef boost::unique_lock<RecLock> UniqueRecLock;
-  RecLock m_cacheLock;
-};
-
-} // Ndnx
-
-#endif // NDNX_VERIFIER_H
diff --git a/ndnx/ndnx-wrapper.cpp b/ndnx/ndnx-wrapper.cpp
deleted file mode 100644
index ab177ce..0000000
--- a/ndnx/ndnx-wrapper.cpp
+++ /dev/null
@@ -1,783 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ndnx-wrapper.h"
-extern "C" {
-#include <ndn/fetch.h>
-}
-#include <poll.h>
-#include <boost/throw_exception.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/random.hpp>
-#include <boost/make_shared.hpp>
-#include <boost/algorithm/string.hpp>
-#include <sstream>
-
-#include "ndnx-verifier.h"
-#include "logging.h"
-
-INIT_LOGGER ("Ndnx.Wrapper");
-
-typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
-typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
-
-using namespace std;
-using namespace boost;
-
-namespace Ndnx {
-
-// hack to enable fake signatures
-// min length for signature field is 16, as defined in ndn_buf_decoder.c:728
-const int DEFAULT_SIGNATURE_SIZE = 16;
-
-// Although ndn_buf_decoder.c:745 defines minimum length 16, something else is checking and only 32-byte fake value is accepted by ndnd
-const int PUBLISHER_KEY_SIZE = 32;
-
-static int
-ndn_encode_garbage_Signature(struct ndn_charbuf *buf)
-{
-    int res = 0;
-
-    res |= ndn_charbuf_append_tt(buf, NDN_DTAG_Signature, NDN_DTAG);
-
-    // Let's cheat more.  Default signing algorithm in ndnd is SHA256, so we just need add 32 bytes of garbage
-    static char garbage [DEFAULT_SIGNATURE_SIZE];
-
-    // digest and witness fields are optional, so use default ones
-
-    res |= ndn_charbuf_append_tt(buf, NDN_DTAG_SignatureBits, NDN_DTAG);
-    res |= ndn_charbuf_append_tt(buf, DEFAULT_SIGNATURE_SIZE, NDN_BLOB);
-    res |= ndn_charbuf_append(buf, garbage, DEFAULT_SIGNATURE_SIZE);
-    res |= ndn_charbuf_append_closer(buf);
-
-    res |= ndn_charbuf_append_closer(buf);
-
-    return(res == 0 ? 0 : -1);
-}
-
-static int
-ndn_pack_unsigned_ContentObject(struct ndn_charbuf *buf,
-                                const struct ndn_charbuf *Name,
-                                const struct ndn_charbuf *SignedInfo,
-                                const void *data,
-                                size_t size)
-{
-    int res = 0;
-    struct ndn_charbuf *content_header;
-    size_t closer_start;
-
-    content_header = ndn_charbuf_create();
-    res |= ndn_charbuf_append_tt(content_header, NDN_DTAG_Content, NDN_DTAG);
-    if (size != 0)
-        res |= ndn_charbuf_append_tt(content_header, size, NDN_BLOB);
-    closer_start = content_header->length;
-    res |= ndn_charbuf_append_closer(content_header);
-    if (res < 0)
-        return(-1);
-
-    res |= ndn_charbuf_append_tt(buf, NDN_DTAG_ContentObject, NDN_DTAG);
-
-    res |= ndn_encode_garbage_Signature(buf);
-
-    res |= ndn_charbuf_append_charbuf(buf, Name);
-    res |= ndn_charbuf_append_charbuf(buf, SignedInfo);
-    res |= ndnb_append_tagged_blob(buf, NDN_DTAG_Content, data, size);
-    res |= ndn_charbuf_append_closer(buf);
-
-    ndn_charbuf_destroy(&content_header);
-    return(res == 0 ? 0 : -1);
-}
-
-NdnxWrapper::NdnxWrapper()
-  : m_handle (0)
-  , m_running (true)
-  , m_connected (false)
-  , m_executor (new Executor(1))
-  , m_verifier(new Verifier(this))
-{
-  start ();
-}
-
-void
-NdnxWrapper::connectNdnd()
-{
-  if (m_handle != 0) {
-    ndn_disconnect (m_handle);
-    //ndn_destroy (&m_handle);
-  }
-  else
-    {
-      m_handle = ndn_create ();
-    }
-
-  UniqueRecLock lock(m_mutex);
-  if (ndn_connect(m_handle, NULL) < 0)
-  {
-    BOOST_THROW_EXCEPTION (NdnxOperationException() << errmsg_info_str("connection to ndnd failed"));
-  }
-  m_connected = true;
-
-  if (!m_registeredInterests.empty())
-  {
-   for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
-    {
-      clearInterestFilter(it->first, false);
-      setInterestFilter(it->first, it->second, false);
-    }
-  }
-}
-
-NdnxWrapper::~NdnxWrapper()
-{
-  shutdown ();
-  if (m_verifier != 0)
-  {
-    delete m_verifier;
-    m_verifier = 0;
-}
-}
-
-void
-NdnxWrapper::start () // called automatically in constructor
-{
-  connectNdnd();
-  m_thread = thread (&NdnxWrapper::ndnLoop, this);
-  m_executor->start();
-}
-
-void
-NdnxWrapper::shutdown () // called in destructor, but can called manually
-{
-  m_executor->shutdown();
-
-  {
-    UniqueRecLock lock(m_mutex);
-    m_running = false;
-  }
-
-  _LOG_DEBUG ("+++++++++SHUTDOWN+++++++");
-  if (m_connected)
-    {
-      m_thread.join ();
-
-      ndn_disconnect (m_handle);
-      //ndn_destroy (&m_handle);
-      m_connected = false;
-    }
-}
-
-void
-NdnxWrapper::ndnLoop ()
-{
-  static boost::mt19937 randomGenerator (static_cast<unsigned int> (std::time (0)));
-  static boost::variate_generator<boost::mt19937&, boost::uniform_int<> > rangeUniformRandom (randomGenerator, uniform_int<> (0,1000));
-
-  while (m_running)
-    {
-      try
-        {
-          int res = 0;
-          {
-            UniqueRecLock lock(m_mutex);
-            res = ndn_run (m_handle, 0);
-          }
-
-          if (!m_running) break;
-
-          if (res < 0) {
-            _LOG_ERROR ("ndn_run returned negative status: " << res);
-
-            BOOST_THROW_EXCEPTION (NdnxOperationException()
-                                   << errmsg_info_str("ndn_run returned error"));
-          }
-
-
-          pollfd pfds[1];
-          {
-            UniqueRecLock lock(m_mutex);
-
-            pfds[0].fd = ndn_get_connection_fd (m_handle);
-            pfds[0].events = POLLIN;
-            if (ndn_output_is_pending (m_handle))
-              pfds[0].events |= POLLOUT;
-          }
-
-          int ret = poll (pfds, 1, 1);
-          if (ret < 0)
-            {
-              BOOST_THROW_EXCEPTION (NdnxOperationException() << errmsg_info_str("ndnd socket failed (probably ndnd got stopped)"));
-            }
-        }
-        catch (NdnxOperationException &e)
-        {
-          m_connected = false;
-          // probably ndnd has been stopped
-          // try reconnect with sleep
-          int interval = 1;
-          int maxInterval = 32;
-          while (m_running)
-          {
-            try
-            {
-              this_thread::sleep (boost::get_system_time () +  boost::posix_time::seconds (interval) + boost::posix_time::milliseconds (rangeUniformRandom ()));
-
-              connectNdnd ();
-              _LOG_DEBUG("reconnect to ndnd succeeded");
-              break;
-            }
-            catch (NdnxOperationException &e)
-            {
-              this_thread::sleep (boost::get_system_time () +  boost::posix_time::seconds (interval) + boost::posix_time::milliseconds (rangeUniformRandom ()));
-
-              // do exponential backup for reconnect interval
-              if (interval < maxInterval)
-              {
-                interval *= 2;
-              }
-            }
-          }
-        }
-        catch (const std::exception &exc)
-          {
-            // catch anything thrown within try block that derives from std::exception
-            std::cerr << exc.what();
-          }
-        catch (...)
-          {
-            cout << "UNKNOWN EXCEPTION !!!" << endl;
-          }
-     }
-}
-
-Bytes
-NdnxWrapper::createContentObject(const Name  &name, const void *buf, size_t len, int freshness, const Name &keyNameParam)
-{
-  {
-    UniqueRecLock lock(m_mutex);
-    if (!m_running || !m_connected)
-      {
-        _LOG_TRACE ("<< not running or connected");
-        return Bytes ();
-      }
-  }
-
-  NdnxCharbufPtr ptr = name.toNdnxCharbuf();
-  ndn_charbuf *pname = ptr->getBuf();
-  ndn_charbuf *content = ndn_charbuf_create();
-
-  struct ndn_signing_params sp = NDN_SIGNING_PARAMS_INIT;
-  sp.freshness = freshness;
-
-  Name keyName;
-
-  if (keyNameParam.size() == 0)
-  {
-    // use default key name
-    NdnxCharbufPtr defaultKeyNamePtr = boost::make_shared<NdnxCharbuf>();
-    ndn_get_public_key_and_name(m_handle, &sp, NULL, NULL, defaultKeyNamePtr->getBuf());
-    keyName = Name(*defaultKeyNamePtr);
-  }
-  else
-  {
-    keyName = keyNameParam;
-  }
-
-  if (sp.template_ndnb == NULL)
-    {
-    sp.template_ndnb = ndn_charbuf_create();
-    ndn_charbuf_append_tt(sp.template_ndnb, NDN_DTAG_SignedInfo, NDN_DTAG);
-    }
-    // no idea what the following 3 lines do, but it was there
-  else if (sp.template_ndnb->length > 0) {
-      sp.template_ndnb->length--;
-    }
-  ndn_charbuf_append_tt(sp.template_ndnb, NDN_DTAG_KeyLocator, NDN_DTAG);
-  ndn_charbuf_append_tt(sp.template_ndnb, NDN_DTAG_KeyName, NDN_DTAG);
-  NdnxCharbufPtr keyPtr = keyName.toNdnxCharbuf();
-  ndn_charbuf *keyBuf = keyPtr->getBuf();
-  ndn_charbuf_append(sp.template_ndnb, keyBuf->buf, keyBuf->length);
-  ndn_charbuf_append_closer(sp.template_ndnb); // </KeyName>
-  ndn_charbuf_append_closer(sp.template_ndnb); // </KeyLocator>
-  sp.sp_flags |= NDN_SP_TEMPL_KEY_LOCATOR;
-  ndn_charbuf_append_closer(sp.template_ndnb); // </SignedInfo>
-
-  if (ndn_sign_content(m_handle, content, pname, &sp, buf, len) != 0)
-  {
-    BOOST_THROW_EXCEPTION(NdnxOperationException() << errmsg_info_str("sign content failed"));
-  }
-
-  Bytes bytes;
-  readRaw(bytes, content->buf, content->length);
-
-  ndn_charbuf_destroy (&content);
-  if (sp.template_ndnb != NULL)
-  {
-    ndn_charbuf_destroy (&sp.template_ndnb);
-  }
-
-  return bytes;
-}
-
-int
-NdnxWrapper::putToNdnd (const Bytes &contentObject)
-{
-  _LOG_TRACE (">> putToNdnd");
-  UniqueRecLock lock(m_mutex);
-  if (!m_running || !m_connected)
-    {
-      _LOG_TRACE ("<< not running or connected");
-      return -1;
-    }
-
-
-  if (ndn_put(m_handle, head(contentObject), contentObject.size()) < 0)
-  {
-    _LOG_ERROR ("ndn_put failed");
-    // BOOST_THROW_EXCEPTION(NdnxOperationException() << errmsg_info_str("ndnput failed"));
-  }
-  else
-    {
-      _LOG_DEBUG ("<< putToNdnd");
-    }
-
-  return 0;
-}
-
-int
-NdnxWrapper::publishData (const Name &name, const unsigned char *buf, size_t len, int freshness, const Name &keyName)
-{
-  Bytes co = createContentObject(name, buf, len, freshness, keyName);
-  return putToNdnd(co);
-}
-
-int
-NdnxWrapper::publishUnsignedData(const Name &name, const unsigned char *buf, size_t len, int freshness)
-{
-  {
-    UniqueRecLock lock(m_mutex);
-    if (!m_running || !m_connected)
-      {
-        _LOG_TRACE ("<< not running or connected");
-        return -1;
-      }
-  }
-
-  NdnxCharbufPtr ptr = name.toNdnxCharbuf();
-  ndn_charbuf *pname = ptr->getBuf();
-  ndn_charbuf *content = ndn_charbuf_create();
-  ndn_charbuf *signed_info = ndn_charbuf_create();
-
-  static char fakeKey[PUBLISHER_KEY_SIZE];
-
-  int res = ndn_signed_info_create(signed_info,
-                                   fakeKey, PUBLISHER_KEY_SIZE,
-                                   NULL,
-                                   NDN_CONTENT_DATA,
-                                   freshness,
-                                   NULL,
-                                   NULL  // ndnd is happy with absent key locator and key itself... ha ha
-                                   );
-  ndn_pack_unsigned_ContentObject(content, pname, signed_info, buf, len);
-
-  Bytes bytes;
-  readRaw(bytes, content->buf, content->length);
-
-  ndn_charbuf_destroy (&content);
-  ndn_charbuf_destroy (&signed_info);
-
-  return putToNdnd (bytes);
-}
-
-
-static void
-deleterInInterestTuple (tuple<NdnxWrapper::InterestCallback *, ExecutorPtr> *tuple)
-{
-  delete tuple->get<0> ();
-  delete tuple;
-}
-
-static ndn_upcall_res
-incomingInterest(ndn_closure *selfp,
-                 ndn_upcall_kind kind,
-                 ndn_upcall_info *info)
-{
-  NdnxWrapper::InterestCallback *f;
-  ExecutorPtr executor;
-  tuple<NdnxWrapper::InterestCallback *, ExecutorPtr> *realData = reinterpret_cast< tuple<NdnxWrapper::InterestCallback *, ExecutorPtr>* > (selfp->data);
-  tie (f, executor) = *realData;
-
-  switch (kind)
-    {
-    case NDN_UPCALL_FINAL: // effective in unit tests
-      // delete closure;
-      executor->execute (bind (deleterInInterestTuple, realData));
-
-      delete selfp;
-      _LOG_TRACE ("<< incomingInterest with NDN_UPCALL_FINAL");
-      return NDN_UPCALL_RESULT_OK;
-
-    case NDN_UPCALL_INTEREST:
-      _LOG_TRACE (">> incomingInterest upcall: " << Name(info->interest_ndnb, info->interest_comps));
-      break;
-
-    default:
-      _LOG_TRACE ("<< incomingInterest with NDN_UPCALL_RESULT_OK: " << Name(info->interest_ndnb, info->interest_comps));
-      return NDN_UPCALL_RESULT_OK;
-    }
-
-  Name interest(info->interest_ndnb, info->interest_comps);
-  Selectors selectors(info->pi);
-
-  executor->execute (bind (*f, interest, selectors));
-  // this will be run in executor
-  // (*f) (interest);
-  // closure->runInterestCallback(interest);
-
-  return NDN_UPCALL_RESULT_OK;
-}
-
-static void
-deleterInDataTuple (tuple<Closure *, ExecutorPtr, Selectors> *tuple)
-{
-  delete tuple->get<0> ();
-  delete tuple;
-}
-
-static ndn_upcall_res
-incomingData(ndn_closure *selfp,
-             ndn_upcall_kind kind,
-             ndn_upcall_info *info)
-{
-  // Closure *cp = static_cast<Closure *> (selfp->data);
-  Closure *cp;
-  ExecutorPtr executor;
-  Selectors selectors;
-  tuple<Closure *, ExecutorPtr, Selectors> *realData = reinterpret_cast< tuple<Closure*, ExecutorPtr, Selectors>* > (selfp->data);
-  tie (cp, executor, selectors) = *realData;
-
-  switch (kind)
-    {
-    case NDN_UPCALL_FINAL:  // effecitve in unit tests
-      executor->execute (bind (deleterInDataTuple, realData));
-
-      cp = NULL;
-      delete selfp;
-      _LOG_TRACE ("<< incomingData with NDN_UPCALL_FINAL");
-      return NDN_UPCALL_RESULT_OK;
-
-    case NDN_UPCALL_CONTENT:
-      _LOG_TRACE (">> incomingData content upcall: " << Name (info->content_ndnb, info->content_comps));
-      break;
-
-    // this is the case where the intentionally unsigned packets coming (in Encapsulation case)
-    case NDN_UPCALL_CONTENT_BAD:
-      _LOG_TRACE (">> incomingData content bad upcall: " << Name (info->content_ndnb, info->content_comps));
-      break;
-
-    // always ask ndnd to try to fetch the key
-    case NDN_UPCALL_CONTENT_UNVERIFIED:
-      _LOG_TRACE (">> incomingData content unverified upcall: " << Name (info->content_ndnb, info->content_comps));
-      break;
-
-    case NDN_UPCALL_INTEREST_TIMED_OUT: {
-      if (cp != NULL)
-      {
-        Name interest(info->interest_ndnb, info->interest_comps);
-        _LOG_TRACE ("<< incomingData timeout: " << Name (info->interest_ndnb, info->interest_comps));
-        executor->execute (bind (&Closure::runTimeoutCallback, cp, interest, *cp, selectors));
-      }
-      else
-        {
-          _LOG_TRACE ("<< incomingData timeout, but callback is not set...: " << Name (info->interest_ndnb, info->interest_comps));
-        }
-      return NDN_UPCALL_RESULT_OK;
-    }
-
-    default:
-      _LOG_TRACE(">> unknown upcall type");
-      return NDN_UPCALL_RESULT_OK;
-    }
-
-  PcoPtr pco = make_shared<ParsedContentObject> (info->content_ndnb, info->pco->offset[NDN_PCO_E]);
-
-  // this will be run in executor
-  executor->execute (bind (&Closure::runDataCallback, cp, pco->name (), pco));
-  _LOG_TRACE (">> incomingData");
-
-  return NDN_UPCALL_RESULT_OK;
-}
-
-int NdnxWrapper::sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors)
-{
-  _LOG_TRACE (">> sendInterest: " << interest);
-  {
-    UniqueRecLock lock(m_mutex);
-    if (!m_running || !m_connected)
-      {
-        _LOG_ERROR ("<< sendInterest: not running or connected");
-        return -1;
-      }
-  }
-
-  NdnxCharbufPtr namePtr = interest.toNdnxCharbuf();
-  ndn_charbuf *pname = namePtr->getBuf();
-  ndn_closure *dataClosure = new ndn_closure;
-
-  // Closure *myClosure = new ExecutorClosure(closure, m_executor);
-  Closure *myClosure = closure.dup ();
-  dataClosure->data = new tuple<Closure*, ExecutorPtr, Selectors> (myClosure, m_executor, selectors);
-
-  dataClosure->p = &incomingData;
-
-  NdnxCharbufPtr selectorsPtr = selectors.toNdnxCharbuf();
-  ndn_charbuf *templ = NULL;
-  if (selectorsPtr)
-  {
-    templ = selectorsPtr->getBuf();
-  }
-
-  UniqueRecLock lock(m_mutex);
-  if (ndn_express_interest (m_handle, pname, dataClosure, templ) < 0)
-  {
-    _LOG_ERROR ("<< sendInterest: ndn_express_interest FAILED!!!");
-  }
-
-  return 0;
-}
-
-int NdnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback, bool record/* = true*/)
-{
-  _LOG_TRACE (">> setInterestFilter");
-  UniqueRecLock lock(m_mutex);
-  if (!m_running || !m_connected)
-  {
-    return -1;
-  }
-
-  NdnxCharbufPtr ptr = prefix.toNdnxCharbuf();
-  ndn_charbuf *pname = ptr->getBuf();
-  ndn_closure *interestClosure = new ndn_closure;
-
-  // interestClosure->data = new ExecutorInterestClosure(interestCallback, m_executor);
-
-  interestClosure->data = new tuple<NdnxWrapper::InterestCallback *, ExecutorPtr> (new InterestCallback (interestCallback), m_executor); // should be removed when closure is removed
-  interestClosure->p = &incomingInterest;
-
-  int ret = ndn_set_interest_filter (m_handle, pname, interestClosure);
-  if (ret < 0)
-  {
-    _LOG_ERROR ("<< setInterestFilter: ndn_set_interest_filter FAILED");
-  }
-
-  if (record)
-    {
-      m_registeredInterests.insert(pair<Name, InterestCallback>(prefix, interestCallback));
-    }
-
-  _LOG_TRACE ("<< setInterestFilter");
-
-  return ret;
-}
-
-void
-NdnxWrapper::clearInterestFilter (const Name &prefix, bool record/* = true*/)
-{
-  _LOG_TRACE (">> clearInterestFilter");
-  UniqueRecLock lock(m_mutex);
-  if (!m_running || !m_connected)
-    return;
-
-  NdnxCharbufPtr ptr = prefix.toNdnxCharbuf();
-  ndn_charbuf *pname = ptr->getBuf();
-
-  int ret = ndn_set_interest_filter (m_handle, pname, 0);
-  if (ret < 0)
-  {
-  }
-
-  if (record)
-    {
-      m_registeredInterests.erase(prefix);
-    }
-
-  _LOG_TRACE ("<< clearInterestFilter");
-}
-
-Name
-NdnxWrapper::getLocalPrefix ()
-{
-  struct ndn * tmp_handle = ndn_create ();
-  int res = ndn_connect (tmp_handle, NULL);
-  if (res < 0)
-    {
-      return Name();
-    }
-
-  string retval = "";
-
-  struct ndn_charbuf *templ = ndn_charbuf_create();
-  ndn_charbuf_append_tt(templ, NDN_DTAG_Interest, NDN_DTAG);
-  ndn_charbuf_append_tt(templ, NDN_DTAG_Name, NDN_DTAG);
-  ndn_charbuf_append_closer(templ); /* </Name> */
-  // XXX - use pubid if possible
-  ndn_charbuf_append_tt(templ, NDN_DTAG_MaxSuffixComponents, NDN_DTAG);
-  ndnb_append_number(templ, 1);
-  ndn_charbuf_append_closer(templ); /* </MaxSuffixComponents> */
-  ndnb_tagged_putf(templ, NDN_DTAG_Scope, "%d", 2);
-  ndn_charbuf_append_closer(templ); /* </Interest> */
-
-  struct ndn_charbuf *name = ndn_charbuf_create ();
-  res = ndn_name_from_uri (name, "/local/ndn/prefix");
-  if (res < 0) {
-  }
-  else
-    {
-      struct ndn_fetch *fetch = ndn_fetch_new (tmp_handle);
-
-      struct ndn_fetch_stream *stream = ndn_fetch_open (fetch, name, "/local/ndn/prefix",
-                                                        NULL, 4, NDN_V_HIGHEST, 0);
-      if (stream == NULL) {
-      }
-      else
-        {
-          ostringstream os;
-
-          int counter = 0;
-          char buf[256];
-          while (true) {
-            res = ndn_fetch_read (stream, buf, sizeof(buf));
-
-            if (res == 0) {
-              break;
-            }
-
-            if (res > 0) {
-              os << string(buf, res);
-            } else if (res == NDN_FETCH_READ_NONE) {
-              if (counter < 2)
-                {
-                  ndn_run(tmp_handle, 1000);
-                  counter ++;
-                }
-              else
-                {
-                  break;
-                }
-            } else if (res == NDN_FETCH_READ_END) {
-              break;
-            } else if (res == NDN_FETCH_READ_TIMEOUT) {
-              break;
-            } else {
-              break;
-            }
-          }
-          retval = os.str ();
-          stream = ndn_fetch_close(stream);
-        }
-      fetch = ndn_fetch_destroy(fetch);
-    }
-
-  ndn_charbuf_destroy (&name);
-
-  ndn_disconnect (tmp_handle);
-  ndn_destroy (&tmp_handle);
-
-  boost::algorithm::trim(retval);
-  return Name(retval);
-}
-
-bool
-NdnxWrapper::verify(PcoPtr &pco, double maxWait)
-{
-  return m_verifier->verify(pco, maxWait);
-}
-
-// This is needed just for get function implementation
-struct GetState
-{
-  GetState (double maxWait)
-  {
-    double intPart, fraction;
-    fraction = modf (std::abs(maxWait), &intPart);
-
-    m_maxWait = date_time::second_clock<boost::posix_time::ptime>::universal_time()
-      + boost::posix_time::seconds (intPart)
-      + boost::posix_time::microseconds (fraction * 1000000);
-  }
-
-  PcoPtr
-  WaitForResult ()
-  {
-    //_LOG_TRACE("GetState::WaitForResult start");
-    boost::unique_lock<boost::mutex> lock (m_mutex);
-    m_cond.timed_wait (lock, m_maxWait);
-    //_LOG_TRACE("GetState::WaitForResult finish");
-
-    return m_retval;
-  }
-
-  void
-  DataCallback (Name name, PcoPtr pco)
-  {
-    //_LOG_TRACE("GetState::DataCallback, Name [" << name << "]");
-    boost::unique_lock<boost::mutex> lock (m_mutex);
-    m_retval = pco;
-    m_cond.notify_one ();
-  }
-
-  void
-  TimeoutCallback (Name name)
-  {
-    boost::unique_lock<boost::mutex> lock (m_mutex);
-    m_cond.notify_one ();
-  }
-
-private:
-  boost::posix_time::ptime m_maxWait;
-
-  boost::mutex m_mutex;
-  boost::condition_variable    m_cond;
-
-  PcoPtr  m_retval;
-};
-
-
-PcoPtr
-NdnxWrapper::get(const Name &interest, const Selectors &selectors, double maxWait/* = 4.0*/)
-{
-  _LOG_TRACE (">> get: " << interest);
-  {
-    UniqueRecLock lock(m_mutex);
-    if (!m_running || !m_connected)
-      {
-        _LOG_ERROR ("<< get: not running or connected");
-        return PcoPtr ();
-      }
-  }
-
-  GetState state (maxWait);
-  this->sendInterest (interest, Closure (boost::bind (&GetState::DataCallback, &state, _1, _2),
-                                         boost::bind (&GetState::TimeoutCallback, &state, _1)),
-                      selectors);
-  return state.WaitForResult ();
-}
-
-}
diff --git a/ndnx/ndnx-wrapper.h b/ndnx/ndnx-wrapper.h
deleted file mode 100644
index 9da54f6..0000000
--- a/ndnx/ndnx-wrapper.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef NDNX_WRAPPER_H
-#define NDNX_WRAPPER_H
-
-#include <boost/thread/locks.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-#include <boost/thread/thread.hpp>
-
-#include "ndnx-common.h"
-#include "ndnx-name.h"
-#include "ndnx-selectors.h"
-#include "ndnx-closure.h"
-#include "ndnx-pco.h"
-#include "executor.h"
-
-namespace Ndnx {
-
-struct NdnxOperationException : boost::exception, std::exception { };
-
-class Verifier;
-class NdnxWrapper
-{
-public:
-  const static int MAX_FRESHNESS = 2147; // max value for ndnx
-  const static int DEFAULT_FRESHNESS = 60;
-  typedef boost::function<void (Name, Selectors)> InterestCallback;
-
-  NdnxWrapper();
-  ~NdnxWrapper();
-
-  void
-  start (); // called automatically in constructor
-
-  /**
-   * @brief Because of uncertainty with executor, in some case it is necessary to call shutdown explicitly (see test-server-and-fetch.cc)
-   */
-  void
-  shutdown (); // called in destructor, but can called manually
-
-  int
-  setInterestFilter (const Name &prefix, const InterestCallback &interestCallback, bool record = true);
-
-  void
-  clearInterestFilter (const Name &prefix, bool record = true);
-
-  int
-  sendInterest (const Name &interest, const Closure &closure, const Selectors &selector = Selectors());
-
-  int
-  publishData (const Name &name, const unsigned char *buf, size_t len, int freshness = DEFAULT_FRESHNESS, const Name &keyName=Name());
-
-  inline int
-  publishData (const Name &name, const Bytes &content, int freshness = DEFAULT_FRESHNESS, const Name &keyName=Name());
-
-  inline int
-  publishData (const Name &name, const std::string &content, int freshness = DEFAULT_FRESHNESS, const Name &keyName=Name());
-
-  int
-  publishUnsignedData(const Name &name, const unsigned char *buf, size_t len, int freshness = DEFAULT_FRESHNESS);
-
-  inline int
-  publishUnsignedData(const Name &name, const Bytes &content, int freshness = DEFAULT_FRESHNESS);
-
-  inline int
-  publishUnsignedData(const Name &name, const std::string &content, int freshness = DEFAULT_FRESHNESS);
-
-  static Name
-  getLocalPrefix ();
-
-  Bytes
-  createContentObject(const Name &name, const void *buf, size_t len, int freshness = DEFAULT_FRESHNESS, const Name &keyNameParam=Name());
-
-  int
-  putToNdnd (const Bytes &contentObject);
-
-  bool
-  verify(PcoPtr &pco, double maxWait = 1 /*seconds*/);
-
-  PcoPtr
-  get (const Name &interest, const Selectors &selector = Selectors(), double maxWait = 4.0/*seconds*/);
-
-private:
-  NdnxWrapper(const NdnxWrapper &other) {}
-
-protected:
-  void
-  connectNdnd();
-
-  /// @cond include_hidden
-  void
-  ndnLoop ();
-
-  /// @endcond
-
-protected:
-  typedef boost::shared_mutex Lock;
-  typedef boost::unique_lock<Lock> WriteLock;
-  typedef boost::shared_lock<Lock> ReadLock;
-
-  typedef boost::recursive_mutex RecLock;
-  typedef boost::unique_lock<RecLock> UniqueRecLock;
-
-  ndn* m_handle;
-  RecLock m_mutex;
-  boost::thread m_thread;
-  bool m_running;
-  bool m_connected;
-  std::map<Name, InterestCallback> m_registeredInterests;
-  ExecutorPtr m_executor;
-  Verifier *m_verifier;
-};
-
-typedef boost::shared_ptr<NdnxWrapper> NdnxWrapperPtr;
-
-inline int
-NdnxWrapper::publishData (const Name &name, const Bytes &content, int freshness, const Name &keyName)
-{
-  return publishData(name, head(content), content.size(), freshness, keyName);
-}
-
-inline int
-NdnxWrapper::publishData (const Name &name, const std::string &content, int freshness, const Name &keyName)
-{
-  return publishData(name, reinterpret_cast<const unsigned char *> (content.c_str ()), content.size (), freshness, keyName);
-}
-
-inline int
-NdnxWrapper::publishUnsignedData(const Name &name, const Bytes &content, int freshness)
-{
-  return publishUnsignedData(name, head(content), content.size(), freshness);
-}
-
-inline int
-NdnxWrapper::publishUnsignedData(const Name &name, const std::string &content, int freshness)
-{
-  return publishUnsignedData(name, reinterpret_cast<const unsigned char *> (content.c_str ()), content.size (), freshness);
-}
-
-
-} // Ndnx
-
-#endif
diff --git a/osx/auto-update/auto-update.h b/osx/auto-update/auto-update.hpp
similarity index 100%
rename from osx/auto-update/auto-update.h
rename to osx/auto-update/auto-update.hpp
diff --git a/osx/auto-update/sparkle-auto-update.h b/osx/auto-update/sparkle-auto-update.h
deleted file mode 100644
index 1a19b9c..0000000
--- a/osx/auto-update/sparkle-auto-update.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef SPARKLE_AUTO_UPDATE_H
-#define SPARKLE_AUTO_UPDATE_H
-
-#include "auto-update.h"
-#include <QString>
-
-class SparkleAutoUpdate : public AutoUpdate
-{
-public:
-  SparkleAutoUpdate (const QString &url);
-  virtual ~SparkleAutoUpdate ();
-  virtual void checkForUpdates();
-private:
-  class Private;
-  Private *d;
-};
-
-#endif
diff --git a/scheduler/interval-generator.h b/scheduler/interval-generator.h
deleted file mode 100644
index 027e6ab..0000000
--- a/scheduler/interval-generator.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef INTERVAL_GENERATOR_H
-#define INTERVAL_GENERATOR_H
-
-#include <boost/shared_ptr.hpp>
-
-using namespace std;
-
-class IntervalGenerator;
-typedef boost::shared_ptr<IntervalGenerator> IntervalGeneratorPtr;
-
-class IntervalGenerator
-{
-public:
-  virtual ~IntervalGenerator () { }
-  
-  virtual double
-  nextInterval() = 0;
-};
-
-
-#endif // INTERVAL_GENERATOR_H
diff --git a/scheduler/one-time-task.cc b/scheduler/one-time-task.cc
deleted file mode 100644
index e31c951..0000000
--- a/scheduler/one-time-task.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "one-time-task.h"
-#include "scheduler.h"
-
-OneTimeTask::OneTimeTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, double delay)
-            : Task(callback, tag, scheduler)
-{
-  setTv(delay);
-}
-
-void
-OneTimeTask::run()
-{
-  if (!m_invoked)
-  {
-    m_callback();
-    m_invoked = true;
-    deregisterSelf();
-  }
-}
-
-void
-OneTimeTask::deregisterSelf()
-{
-  m_scheduler->deleteTask(m_tag);
-}
-
-void
-OneTimeTask::reset()
-{
-  m_invoked = false;
-}
diff --git a/scheduler/one-time-task.h b/scheduler/one-time-task.h
deleted file mode 100644
index 1b900e1..0000000
--- a/scheduler/one-time-task.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef ONE_TIME_TASK_H
-#define ONE_TIME_TASK_H
-
-#include "task.h"
-
-class OneTimeTask : public Task
-{
-public:
-  OneTimeTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, double delay);
-  virtual ~OneTimeTask(){}
-
-  // invoke callback and mark self as invoked and deregister self from scheduler
-  virtual void
-  run() _OVERRIDE;
-
-  // after reset, the task is marked as un-invoked and can be add to scheduler again, with same delay
-  // if not invoked yet, no effect
-  virtual void
-  reset() _OVERRIDE;
-
-private:
-  // this is to deregister itself from scheduler automatically after invoke
-  void
-  deregisterSelf();
-};
-
-
-#endif // EVENT_SCHEDULER_H
diff --git a/scheduler/periodic-task.cc b/scheduler/periodic-task.cc
deleted file mode 100644
index 947107c..0000000
--- a/scheduler/periodic-task.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "periodic-task.h"
-#include "logging.h"
-#include <utility>
-
-INIT_LOGGER ("Scheduler.PeriodicTask");
-
-PeriodicTask::PeriodicTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler,
-                           IntervalGeneratorPtr generator)
-  : Task(callback, tag, scheduler)
-  , m_generator(generator)
-{
-}
-
-void
-PeriodicTask::run()
-{
-  if (!m_invoked)
-  {
-    m_invoked = true;
-    m_callback();
-
-    if (m_invoked)
-      {
-        // m_invoked getting back if it is rescheduled inside the callback
-        m_scheduler->rescheduleTask(m_tag);
-      }
-  }
-}
-
-void
-PeriodicTask::reset()
-{
-  m_invoked = false;
-  double interval = m_generator->nextInterval();
-  setTv(interval);
-}
diff --git a/scheduler/periodic-task.h b/scheduler/periodic-task.h
deleted file mode 100644
index f36d71a..0000000
--- a/scheduler/periodic-task.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef PERIODIC_TASK_H
-#define PERIODIC_TASK_H
-
-#include "task.h"
-#include "scheduler.h"
-#include "interval-generator.h"
-
-class PeriodicTask : public Task
-{
-public:
-  // generator is needed only when this is a periodic task
-  // two simple generators implementation (SimpleIntervalGenerator and RandomIntervalGenerator) are provided;
-  // if user needs more complex pattern in the intervals between calls, extend class IntervalGenerator
-  PeriodicTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, IntervalGeneratorPtr generator);
-  virtual ~PeriodicTask(){}
-
-  // invoke callback, reset self and ask scheduler to schedule self with the next delay interval
-  virtual void
-  run() _OVERRIDE;
-
-  // set the next delay and mark as un-invoke
-  virtual void
-  reset() _OVERRIDE;
-
-private:
-  IntervalGeneratorPtr m_generator;
-};
-
-#endif // PERIODIC_TASK_H
diff --git a/scheduler/random-interval-generator.h b/scheduler/random-interval-generator.h
deleted file mode 100644
index bd46214..0000000
--- a/scheduler/random-interval-generator.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef RANDOM_INTERVAL_GENERATOR_H
-#define RANDOM_INTERVAL_GENERATOR_H
-
-#include "interval-generator.h"
-
-#include <boost/random/mersenne_twister.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/variate_generator.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-
-// generates intervals with uniform distribution
-class RandomIntervalGenerator : public IntervalGenerator
-{
-public:
-  typedef enum
-  {
-    UP = 1,
-    DOWN = 2,
-    EVEN = 3
-  } Direction;
-
-public:
-  // percent is random-range/interval; e.g. if interval is 10 and you wish the random-range to be 2
-  // e.g. 9 ~ 11, percent = 0.2
-  // direction shifts the random range; e.g. in the above example, UP would produce a range of
-  // 10 ~ 12, DOWN of 8 ~ 10, and EVEN of 9 ~ 11
-  RandomIntervalGenerator(double interval, double percent, Direction direction = EVEN)
-  // : m_rng(time(NULL))
-    : m_rng (static_cast<int> (boost::posix_time::microsec_clock::local_time().time_of_day ().total_nanoseconds ()))
-  , m_dist(0.0, fractional(percent))
-  , m_random(m_rng, m_dist)
-  , m_direction(direction)
-  , m_percent(percent)
-  , m_interval(interval)
-  { }
-
-  virtual ~RandomIntervalGenerator(){}
-
-  virtual double
-  nextInterval() _OVERRIDE
-  {
-    double percent = m_random();
-    double interval = m_interval;
-    switch (m_direction)
-      {
-      case UP: interval = m_interval * (1.0 + percent); break;
-      case DOWN: interval = m_interval * (1.0 - percent); break;
-      case EVEN: interval = m_interval * (1.0 - m_percent/2.0 + percent); break;
-      default: break;
-      }
-
-    return interval;
-  }
-
-private:
-  inline double fractional(double x) { double dummy; return abs(modf(x, &dummy)); }
-
-private:
-  typedef boost::mt19937 RNG_TYPE;
-  RNG_TYPE m_rng;
-  boost::uniform_real<> m_dist;
-  boost::variate_generator<RNG_TYPE &, boost::uniform_real<> > m_random;
-  Direction m_direction;
-  double m_percent;
-  double m_interval;
-
-};
-#endif // RANDOM_INTERVAL_GENERATOR_H
diff --git a/scheduler/scheduler.cc b/scheduler/scheduler.cc
deleted file mode 100644
index 209e3d1..0000000
--- a/scheduler/scheduler.cc
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "scheduler.h"
-#include "one-time-task.h"
-#include "periodic-task.h"
-#include "logging.h"
-
-#include <utility>
-#include <boost/make_shared.hpp>
-
-INIT_LOGGER ("Scheduler");
-
-using namespace std;
-using namespace boost;
-
-#define EVLOOP_NO_EXIT_ON_EMPTY 0x04
-
-static void
-dummyCallback(evutil_socket_t fd, short what, void *arg)
-{
-  // 1 year later, that was a long run for the app
-  // let's wait for another year
-  timeval tv;
-  tv.tv_sec = 365 * 24 * 3600;
-  tv.tv_usec = 0;
-  event *ev = *(event **)arg;
-  int res = evtimer_add(ev, &tv);
-}
-
-// IntervalGeneratorPtr
-// IntervalGenerator:: Null;
-
-void errorCallback(int err)
-{
-  _LOG_ERROR ("Fatal error: " << err);
-}
-
-Scheduler::Scheduler()
-  : m_running(false)
-  , m_executor(1)
-{
-  event_set_fatal_callback(errorCallback);
-  evthread_use_pthreads();
-  m_base = event_base_new();
-
-  // This is a hack to prevent event_base_loop from exiting;
-  // the flag EVLOOP_NO_EXIT_ON_EMPTY is somehow ignored, at least on Mac OS X
-  // it's going to be scheduled to 10 years later
-  timeval tv;
-  tv.tv_sec = 365 * 24 * 3600;
-  tv.tv_usec = 0;
-  m_ev = evtimer_new(m_base, dummyCallback, &m_ev);
-  int res = evtimer_add(m_ev, &tv);
-  if (res < 0)
-  {
-    _LOG_ERROR("heck");
-  }
-}
-
-Scheduler::~Scheduler()
-{
-  shutdown ();
-  evtimer_del(m_ev);
-  event_free(m_ev);
-  event_base_free(m_base);
-}
-
-void
-Scheduler::eventLoop()
-{
-  while(true)
-  {
-    if (event_base_loop(m_base, EVLOOP_NO_EXIT_ON_EMPTY) < 0)
-    {
-      _LOG_DEBUG ("scheduler loop break error");
-    }
-    else
-    {
-      _LOG_DEBUG ("scheduler loop break normal");
-    }
-
-    {
-      ScopedLock lock(m_mutex);
-      if (!m_running)
-        {
-          _LOG_DEBUG ("scheduler loop break normal");
-          break;
-        }
-    }
-
-    // just to prevent craziness in CPU usage which supposedly should not happen
-    // after adding the dummy event
-    usleep(1000);
-  }
-}
-
-void
-Scheduler::execute(Executor::Job job)
-{
-  m_executor.execute(job);
-}
-
-void
-Scheduler::start()
-{
-  ScopedLock lock(m_mutex);
-  if (!m_running)
-  {
-    m_thread = boost::thread(&Scheduler::eventLoop, this);
-    m_executor.start();
-    m_running = true;
-  }
-}
-
-void
-Scheduler::shutdown()
-{
-  bool breakAndWait = false;
-  {
-    ScopedLock lock (m_mutex);
-    if (m_running)
-      {
-        m_running = false;
-        breakAndWait = true;
-      }
-  }
-
-  if (breakAndWait)
-    {
-      event_base_loopbreak(m_base);
-      m_executor.shutdown();
-      m_thread.join();
-    }
-}
-
-TaskPtr
-Scheduler::scheduleOneTimeTask (SchedulerPtr scheduler, double delay,
-                                const Task::Callback &callback, const Task::Tag &tag)
-{
-  TaskPtr task = make_shared<OneTimeTask> (callback, tag, scheduler, delay);
-  if (scheduler->addTask (task))
-    return task;
-  else
-    return TaskPtr ();
-}
-
-TaskPtr
-Scheduler::schedulePeriodicTask (SchedulerPtr scheduler, IntervalGeneratorPtr delayGenerator,
-                                 const Task::Callback &callback, const Task::Tag &tag)
-{
-  TaskPtr task = make_shared<PeriodicTask> (callback, tag, scheduler, delayGenerator);
-
-  if (scheduler->addTask (task))
-    return task;
-  else
-    return TaskPtr ();
-}
-
-TaskPtr
-Scheduler::scheduleDelayOneTimeTask (SchedulerPtr scheduler, double delay,
-                                const Task::Callback &callback, const Task::Tag &tag)
-{
-  TaskPtr task = make_shared<OneTimeTask> (callback, tag, scheduler, delay);
-  if (scheduler->addTask (task))
-    return task;
-  else{
-    _LOG_ERROR ("reschedule task for " << tag);
-    scheduler->rescheduleTask(tag);
-    return TaskPtr ();
-  }
-}
-
-bool
-Scheduler::addTask(TaskPtr newTask, bool reset/* = true*/)
-{
-  if (addToMap(newTask))
-  {
-    if (reset)
-      {
-        newTask->reset();
-      }
-    int res = evtimer_add(newTask->ev(), newTask->tv());
-    if (res < 0)
-    {
-      _LOG_ERROR ("evtimer_add failed for " << newTask->tag());
-    }
-    return true;
-  }
-  else
-  {
-    _LOG_ERROR ("fail to add task: " << newTask->tag());
-  }
-
-  return false;
-}
-
-void
-Scheduler::deleteTask(TaskPtr task)
-{
-  deleteTask (task->tag ());
-}
-
-void
-Scheduler::rescheduleTask(TaskPtr task)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.find(task->tag());
-  if (it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    task->reset();
-    int res = evtimer_add(task->ev(), task->tv());
-    if (res < 0)
-    {
-      _LOG_ERROR ("evtimer_add failed for " << task->tag());
-    }
-  }
-  else
-  {
-    addTask(task);
-  }
-}
-
-void
-Scheduler::rescheduleTask(const Task::Tag &tag)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.find(tag);
-  if (it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    task->reset();
-    int res = evtimer_add(task->ev(), task->tv());
-    if (res < 0)
-    {
-      cout << "evtimer_add failed for " << task->tag() << endl;
-    }
-  }
-}
-
-void
-Scheduler::rescheduleTaskAt (const Task::Tag &tag, double time)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.find (tag);
-  if (it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    task->reset();
-    task->setTv (time);
-
-    int res = evtimer_add(task->ev(), task->tv());
-    if (res < 0)
-    {
-      _LOG_ERROR ("evtimer_add failed for " << task->tag());
-    }
-  }
-  else
-    {
-      _LOG_ERROR ("Task for tag " << tag << " not found");
-    }
-}
-
-void
-Scheduler::rescheduleTaskAt (TaskPtr task, double time)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.find(task->tag());
-  if (it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    task->reset();
-    task->setTv (time);
-
-    int res = evtimer_add(task->ev(), task->tv());
-    if (res < 0)
-    {
-      _LOG_ERROR ("evtimer_add failed for " << task->tag());
-    }
-  }
-  else
-  {
-    task->setTv (time); // force different time
-    addTask (task, false);
-  }
-}
-
-
-bool
-Scheduler::addToMap(TaskPtr task)
-{
-  ScopedLock lock(m_mutex);
-  if (m_taskMap.find(task->tag()) == m_taskMap.end())
-  {
-    m_taskMap.insert(make_pair(task->tag(), task));
-    return true;
-  }
-  return false;
-}
-
-void
-Scheduler::deleteTask(const Task::Tag &tag)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.find(tag);
-  if (it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    evtimer_del(task->ev());
-    m_taskMap.erase(it);
-  }
-}
-
-void
-Scheduler::deleteTask(const Task::TaskMatcher &matcher)
-{
-  ScopedLock lock(m_mutex);
-  TaskMapIt it = m_taskMap.begin();
-  while(it != m_taskMap.end())
-  {
-    TaskPtr task = it->second;
-    if (matcher(task))
-    {
-      evtimer_del(task->ev());
-      // Use post increment; map.erase invalidate the iterator that is beening erased,
-      // but does not invalidate other iterators. This seems to be the convention to
-      // erase something from C++ STL map while traversing.
-      m_taskMap.erase(it++);
-    }
-    else
-    {
-      ++it;
-    }
-  }
-}
-
-int
-Scheduler::size()
-{
-  ScopedLock lock(m_mutex);
-  return m_taskMap.size();
-}
diff --git a/scheduler/scheduler.h b/scheduler/scheduler.h
deleted file mode 100644
index a52649a..0000000
--- a/scheduler/scheduler.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef SCHEDULER_H
-#define SCHEDULER_H
-
-#include <event2/event.h>
-#include <event2/thread.h>
-#include <event2/event-config.h>
-#include <event2/util.h>
-
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <boost/exception/all.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-#include <boost/thread/thread.hpp>
-#include <math.h>
-#include <map>
-#include <sys/time.h>
-
-#include "task.h"
-#include "interval-generator.h"
-#include "executor.h"
-
-class Scheduler;
-typedef boost::shared_ptr<Scheduler> SchedulerPtr;
-
-/**
- * @brief Scheduler class
- */
-class Scheduler
-{
-public:
-  Scheduler();
-  virtual ~Scheduler();
-
-  // start event scheduling
-  virtual void
-  start();
-
-  // stop event scheduling
-  virtual void
-  shutdown();
-
-  // helper method to schedule one-time task
-  static TaskPtr
-  scheduleOneTimeTask (SchedulerPtr scheduler, double delay, const Task::Callback &callback, const Task::Tag &tag);
-
-  // helper method to schedule periodic task
-  static TaskPtr
-  schedulePeriodicTask (SchedulerPtr scheduler, IntervalGeneratorPtr delayGenerator,
-                        const Task::Callback &callback, const Task::Tag &tag);
-
-  // helper method to schedule/reschedule one-time task
-  static TaskPtr
-  scheduleDelayOneTimeTask (SchedulerPtr scheduler, double delay, const Task::Callback &callback, const Task::Tag &tag);
-
-  // if task with the same tag exists, the task is not added and return false
-  virtual bool
-  addTask(TaskPtr task, bool reset = true);
-
-  // delete task by task->tag, regardless of whether it's invoked or not
-  virtual void
-  deleteTask(TaskPtr task);
-
-  // delete task by tag, regardless of whether it's invoked or not
-  // if no task is found, no effect
-  virtual void
-  deleteTask(const Task::Tag &tag);
-
-  // delete tasks by matcher, regardless of whether it's invoked or not
-  // this is flexiable in that you can use any form of criteria in finding tasks to delete
-  // but keep in mind this is a linear scan
-
-  // if no task is found, no effect
-  virtual void
-  deleteTask(const Task::TaskMatcher &matcher);
-
-  // task must already have been added to the scheduler, otherwise this method has no effect
-  // this is usually used by PeriodicTask
-  virtual void
-  rescheduleTask(const Task::Tag &tag);
-
-  // if the task is not pending, it will be added to the schedule queue
-  // if the task is pending, the delay is changed to the passed in delay
-  // e.g. if at second 0 task A with delay 5 is originally going to run at second 5 and
-  // rescheduleTask(A) is called at second 4, A will be reschedule to run
-  // at second 9
-  virtual void
-  rescheduleTask(TaskPtr task);
-
-  virtual void
-  rescheduleTaskAt (const Task::Tag &tag, double time);
-
-  virtual void
-  rescheduleTaskAt (TaskPtr task, double time);
-
-  void
-  execute(Executor::Job);
-
-  void
-  eventLoop();
-
-  event_base *
-  base() { return m_base; }
-
-  // used in test
-  int
-  size();
-
-protected:
-  bool
-  addToMap(TaskPtr task);
-
-protected:
-  typedef std::map<Task::Tag, TaskPtr> TaskMap;
-  typedef std::map<Task::Tag, TaskPtr>::iterator TaskMapIt;
-  typedef boost::recursive_mutex Mutex;
-  typedef boost::unique_lock<Mutex> ScopedLock;
-
-  TaskMap m_taskMap;
-  Mutex m_mutex;
-  volatile bool m_running;
-  event_base *m_base;
-  event *m_ev;
-  boost::thread m_thread;
-  Executor m_executor;
-};
-
-struct SchedulerException : virtual boost::exception, virtual std::exception { };
-
-#endif // SCHEDULER_H
diff --git a/scheduler/simple-interval-generator.h b/scheduler/simple-interval-generator.h
deleted file mode 100644
index 06b1181..0000000
--- a/scheduler/simple-interval-generator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef SIMPLE_INTERVAL_GENERATOR_H
-#define SIMPLE_INTERVAL_GENERATOR_H
-
-#include "interval-generator.h"
-
-class SimpleIntervalGenerator : public IntervalGenerator
-{
-public:
-  SimpleIntervalGenerator(double interval) : m_interval (interval) {}
-  virtual ~SimpleIntervalGenerator() {}
-  
-  virtual double
-  nextInterval() _OVERRIDE { return m_interval; }
-
-private:
-  double m_interval;
-};
-
-#endif // SIMPLE_INTERVAL_GENERATOR_H
diff --git a/scheduler/task.cc b/scheduler/task.cc
deleted file mode 100644
index 2f72f06..0000000
--- a/scheduler/task.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "task.h"
-#include "scheduler.h"
-
-static void
-eventCallback(evutil_socket_t fd, short what, void *arg)
-{
-  Task *task = static_cast<Task *>(arg);
-  task->execute();
-  task = NULL;
-}
-
-Task::Task(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler)
-     : m_callback(callback)
-     , m_tag(tag)
-     , m_scheduler(scheduler)
-     , m_invoked(false)
-     , m_event(NULL)
-     , m_tv(NULL)
-{
-  m_event = evtimer_new(scheduler->base(), eventCallback, this);
-  m_tv = new timeval;
-}
-
-Task::~Task()
-{
-  if (m_event != NULL)
-  {
-    event_free(m_event);
-    m_event = NULL;
-  }
-
-  if (m_tv != NULL)
-  {
-    delete m_tv;
-    m_tv = NULL;
-  }
-}
-
-void
-Task::setTv(double delay)
-{
-  // Alex: when using abs function, i would recommend use it with std:: prefix, otherwise
-  // the standard one may be used, which converts everything to INT, making a lot of problems
-  double intPart, fraction;
-  fraction = modf(std::abs(delay), &intPart);
-
-  m_tv->tv_sec = static_cast<int>(intPart);
-  m_tv->tv_usec = static_cast<int>((fraction * 1000000));
-}
-
-void
-Task::execute()
-{
-  // m_scheduler->execute(boost::bind(&Task::run, this));
-
-  // using a shared_ptr of this to ensure that when invoked from executor
-  // the task object still exists
-  // otherwise, it could be the case that the run() is to be executed, but before it
-  // could finish, the TaskPtr gets deleted from scheduler and the task object
-  // gets destroyed, causing crash
-  m_scheduler->execute(boost::bind(&Task::run, shared_from_this()));
-}
diff --git a/scheduler/task.h b/scheduler/task.h
deleted file mode 100644
index 11a9fa6..0000000
--- a/scheduler/task.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef TASK_H
-#define TASK_H
-
-#define _OVERRIDE
-#ifdef __GNUC__
-#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
-  #undef _OVERRIDE
-  #define _OVERRIDE override
-#endif // __GNUC__ version
-#endif // __GNUC__
-
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <sys/time.h>
-
-//////////////////////////////////////////////////
-// forward declarations
-class Task;
-typedef boost::shared_ptr<Task> TaskPtr;
-
-class Scheduler;
-typedef boost::shared_ptr<Scheduler> SchedulerPtr;
-
-struct event;
-//////////////////////////////////////////////////
-
-
-/**
- * @brief Base class for a task
- */
-class Task : public boost::enable_shared_from_this<Task>
-{
-public:
-  // callback of this task
-  typedef boost::function<void ()> Callback;
-  // tag identifies this task, should be unique
-  typedef std::string Tag;
-  // used to match tasks
-  typedef boost::function<bool (const TaskPtr &task)> TaskMatcher;
-
-  // Task is associated with Schedulers due to the requirement that libevent event is associated with an libevent event_base
-  Task(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler);
-  virtual ~Task();
-
-  virtual void
-  run() = 0;
-
-  Tag
-  tag() { return m_tag; }
-
-  event *
-  ev() { return m_event; }
-
-  timeval *
-  tv() { return m_tv; }
-
-  // Task needs to be resetted after the callback is invoked if it is to be schedule again; just for safety
-  // it's called by scheduler automatically when addTask or rescheduleTask is called;
-  // Tasks should do preparation work here (e.g. set up new delay, etc. )
-  virtual void
-  reset() = 0;
-
-  // set delay
-  // This overrides whatever delay kept in m_tv
-  void
-  setTv(double delay);
-
-  void
-  execute();
-
-protected:
-  Callback m_callback;
-  Tag m_tag;
-  SchedulerPtr m_scheduler;
-  bool m_invoked;
-  event *m_event;
-  timeval *m_tv;
-};
-
-
-#endif // TASK_H
diff --git a/src/action-log.cc b/src/action-log.cpp
similarity index 100%
rename from src/action-log.cc
rename to src/action-log.cpp
diff --git a/src/action-log.h b/src/action-log.hpp
similarity index 100%
rename from src/action-log.h
rename to src/action-log.hpp
diff --git a/src/content-server.cc b/src/content-server.cpp
similarity index 100%
rename from src/content-server.cc
rename to src/content-server.cpp
diff --git a/src/content-server.h b/src/content-server.hpp
similarity index 100%
rename from src/content-server.h
rename to src/content-server.hpp
diff --git a/src/db-helper.cc b/src/db-helper.cpp
similarity index 100%
rename from src/db-helper.cc
rename to src/db-helper.cpp
diff --git a/src/db-helper.h b/src/db-helper.hpp
similarity index 100%
rename from src/db-helper.h
rename to src/db-helper.hpp
diff --git a/src/dispatcher.cc b/src/dispatcher.cpp
similarity index 100%
rename from src/dispatcher.cc
rename to src/dispatcher.cpp
diff --git a/src/dispatcher.h b/src/dispatcher.hpp
similarity index 100%
rename from src/dispatcher.h
rename to src/dispatcher.hpp
diff --git a/src/fetch-manager.cc b/src/fetch-manager.cpp
similarity index 100%
rename from src/fetch-manager.cc
rename to src/fetch-manager.cpp
diff --git a/src/fetch-manager.h b/src/fetch-manager.hpp
similarity index 100%
rename from src/fetch-manager.h
rename to src/fetch-manager.hpp
diff --git a/src/fetch-task-db.cc b/src/fetch-task-db.cpp
similarity index 100%
rename from src/fetch-task-db.cc
rename to src/fetch-task-db.cpp
diff --git a/src/fetch-task-db.h b/src/fetch-task-db.hpp
similarity index 100%
rename from src/fetch-task-db.h
rename to src/fetch-task-db.hpp
diff --git a/src/fetcher.cc b/src/fetcher.cpp
similarity index 100%
rename from src/fetcher.cc
rename to src/fetcher.cpp
diff --git a/src/fetcher.h b/src/fetcher.hpp
similarity index 100%
rename from src/fetcher.h
rename to src/fetcher.hpp
diff --git a/src/file-state.cc b/src/file-state.cpp
similarity index 100%
rename from src/file-state.cc
rename to src/file-state.cpp
diff --git a/src/file-state.h b/src/file-state.hpp
similarity index 100%
rename from src/file-state.h
rename to src/file-state.hpp
diff --git a/src/hash-helper.cc b/src/hash-helper.cpp
similarity index 100%
rename from src/hash-helper.cc
rename to src/hash-helper.cpp
diff --git a/src/hash-helper.h b/src/hash-helper.hpp
similarity index 100%
rename from src/hash-helper.h
rename to src/hash-helper.hpp
diff --git a/src/logging.cc b/src/logging.cpp
similarity index 100%
rename from src/logging.cc
rename to src/logging.cpp
diff --git a/src/logging.h b/src/logging.hpp
similarity index 100%
rename from src/logging.h
rename to src/logging.hpp
diff --git a/src/object-db.cc b/src/object-db.cpp
similarity index 100%
rename from src/object-db.cc
rename to src/object-db.cpp
diff --git a/src/object-db.h b/src/object-db.hpp
similarity index 100%
rename from src/object-db.h
rename to src/object-db.hpp
diff --git a/src/object-manager.cc b/src/object-manager.cpp
similarity index 100%
rename from src/object-manager.cc
rename to src/object-manager.cpp
diff --git a/src/object-manager.h b/src/object-manager.hpp
similarity index 100%
rename from src/object-manager.h
rename to src/object-manager.hpp
diff --git a/src/state-server.cc b/src/state-server.cpp
similarity index 100%
rename from src/state-server.cc
rename to src/state-server.cpp
diff --git a/src/state-server.h b/src/state-server.hpp
similarity index 100%
rename from src/state-server.h
rename to src/state-server.hpp
diff --git a/src/sync-core.cc b/src/sync-core.cpp
similarity index 100%
rename from src/sync-core.cc
rename to src/sync-core.cpp
diff --git a/src/sync-core.h b/src/sync-core.hpp
similarity index 100%
rename from src/sync-core.h
rename to src/sync-core.hpp
diff --git a/src/sync-log.cc b/src/sync-log.cpp
similarity index 100%
rename from src/sync-log.cc
rename to src/sync-log.cpp
diff --git a/src/sync-log.h b/src/sync-log.hpp
similarity index 100%
rename from src/sync-log.h
rename to src/sync-log.hpp
diff --git a/src/sync-state-helper.h b/src/sync-state-helper.hpp
similarity index 100%
rename from src/sync-state-helper.h
rename to src/sync-state-helper.hpp
diff --git a/test/client/client.cc b/test/client/client.cc
deleted file mode 100644
index 4f61d52..0000000
--- a/test/client/client.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#include <iostream>
-#include <boost/algorithm/string.hpp>
-#include <config.h>
-#include <Ice/Ice.h>
-#include <chronoshare-client.ice.h>
-#include <sys/stat.h>
-#include <hash-helper.h>
-
-
-using namespace std;
-using namespace boost;
-using namespace ChronoshareClient;
-namespace fs = boost::filesystem;
-
-void
-usage ()
-{
-  cerr << "Usage: chronoshare <cmd> [<options>]\n"
-       << "\n"
-       << "   <cmd> is one of:\n"
-       << "       version\n"
-       << "       update <filename>\n"
-       << "       delete <filename>\n"
-       << "       move <filename> <filename>\n";
-  exit (1);
-}
-
-
-int
-main (int argc, char **argv)
-{
-  if (argc < 2)
-    {
-      usage ();
-    }
-
-  string cmd = argv[1];
-  algorithm::to_lower (cmd);
-  
-  if (cmd == "version")
-    {
-      cout << "chronoshare version " << CHRONOSHARE_VERSION << endl;
-      exit (0);
-    }
-  
-  int status = 0;
-  Ice::CommunicatorPtr ic;
-  try
-    {
-      // Create a communicator
-      //
-      ic = Ice::initialize (argc, argv);
-    
-      Ice::ObjectPrx base = ic->stringToProxy("NotifyDaemon:default -p 55436");
-      if (!base)
-        {
-          throw "Could not create proxy";
-        }
-
-      NotifyPrx notify = NotifyPrx::checkedCast (base);
-      if (notify)
-        {
-
-          if (cmd == "update")
-            {
-              if (argc != 3)
-                {
-                  usage ();
-                }
-
-              fs::path file (argv[2]);
-              fs::file_status fileStatus = fs::status (file);
-              if (is_regular_file (fileStatus))
-                {
-                  // Alex: the following code is platform specific :(
-                  HashPtr fileHash = Hash::FromFileContent (file);
-                  
-                  notify->updateFile (file.generic_string (),
-                                      make_pair(reinterpret_cast<const ::Ice::Byte*> (fileHash->GetHash ()),
-                                                reinterpret_cast<const ::Ice::Byte*> (fileHash->GetHash ()) +
-                                                fileHash->GetHashBytes ()),
-                                      fs::last_write_time (file),
-                                      // fileStats.st_atime, fileStats.st_mtime, fileStats.st_ctime,
-                                      fileStatus.permissions ());
-                }
-              else
-                {
-                  cerr << "File [" << argv[2] << "] doesn't exist or is not accessible" << endl;
-                  return 1;
-                }
-            }
-          else if (cmd == "delete")
-            {
-              if (argc != 3)
-                {
-                  usage ();
-                }
-              
-              notify->deleteFile (argv[2]);
-            }
-          else if (cmd == "move")
-            {
-              if (argc != 4)
-                {
-                  usage ();
-                }
-
-              fs::path srcFile (argv[2]);
-              fs::path dstFile (argv[3]);
-              
-              notify->moveFile (srcFile.generic_string (), dstFile.generic_string ());
-            }
-          else
-            {
-              cerr << "ERROR: Unknown command " << cmd << endl;
-              usage ();
-            }
-        }
-      else
-        {
-          cerr << "ERROR: Cannot connect to the daemon\n";
-          status = 1;
-        }
-    }
-  catch (const Ice::Exception& ex)
-    {
-      cerr << ex << endl;
-      status = 1;
-    }
-  
-  if (ic)
-    ic->destroy();
-  return status;
-}
diff --git a/test/daemon/daemon.cc b/test/daemon/daemon.cc
deleted file mode 100644
index 6983965..0000000
--- a/test/daemon/daemon.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#include "action-log.h"
-#include <iostream>
-#include <Ice/Service.h>
-#include <Ice/Identity.h>
-#include <ndnx-wrapper.h>
-
-#include "notify-i.h"
-#include <boost/make_shared.hpp>
-
-using namespace std;
-using namespace boost;
-using namespace ChronoshareClient;
-using namespace Ndnx;
-
-typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str; 
-
-class MyService : public Ice::Service
-{
-public:
-  MyService (ActionLogPtr actionLog)
-  : m_actionLog (actionLog)
-  {
-  }
-  
-protected:
-  virtual bool start (int, char*[], int&)
-  {
-    _adapter = communicator ()->createObjectAdapterWithEndpoints ("ChronoShare", "default -p 55436");
-
-    Ice::Identity identity;
-    identity.name="NotifyDaemon";
-    NotifyPtr servant=new NotifyI (m_actionLog);
-    
-    _adapter->add (servant, identity);
-    
-    _adapter->activate();
-    // status = EXIT_SUCCESS;
-    return true;    
-  }
-  
-private:
-  Ice::ObjectAdapterPtr _adapter;
-  ActionLogPtr m_actionLog;
-};
-
-int
-main (int argc, char **argv)
-{
-  int status = 0;
-  
-  try
-    {
-      // DbHelper db ("./", "/ndn/ucla.edu/alex");
-      NdnxWrapperPtr ndnx = make_shared<NdnxWrapper> ();
-      ActionLogPtr actionLog = make_shared<ActionLog> (ndnx, "./", "/ndn/ucla.edu/alex", "shared");
-
-      MyService svc (actionLog);
-      status = svc.main (argc, argv);
-
-      // HashPtr hash = db.RememberStateInStateLog ();
-      // // should be empty
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // //
-      // db.UpdateDeviceSeqno ("Alex", 1);
-      // hash = db.RememberStateInStateLog ();
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // db.UpdateDeviceSeqno ("Alex", 2);
-      // hash = db.RememberStateInStateLog ();
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // db.UpdateDeviceSeqno ("Alex", 2);
-      // hash = db.RememberStateInStateLog ();
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // db.UpdateDeviceSeqno ("Alex", 1);
-      // hash = db.RememberStateInStateLog ();
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // db.FindStateDifferences ("00", "ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52");
-      // db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52", "00");
-      // db.FindStateDifferences ("869c38c6dffe8911ced320aecc6d9244904d13d3e8cd21081311f2129b4557ce",
-      //                          "ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52");
-      // db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52",
-      //                          "869c38c6dffe8911ced320aecc6d9244904d13d3e8cd21081311f2129b4557ce");
-
-      // db.UpdateDeviceSeqno ("Bob", 1);
-      // hash = db.RememberStateInStateLog ();
-      // cout << "Hash: [" << *hash << "]" << endl;
-
-      // db.FindStateDifferences ("00", "48f4d95b503b9a79c2d5939fa67722b13fc01db861fc501d09efd0a38dbafab8");
-      // db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52",
-      //                          "48f4d95b503b9a79c2d5939fa67722b13fc01db861fc501d09efd0a38dbafab8");
-    }
-  catch (const Ice::Exception& e)
-    {
-      cerr << e << endl;
-      status = 1;
-    }
-  catch (const boost::exception &e)
-    {
-      cout << "ERRORR: " << *get_error_info<errmsg_info_str> (e) << endl;
-      status = 1;
-    }
-
-  return status;
-}
diff --git a/test/daemon/notify-i.cc b/test/daemon/notify-i.cc
deleted file mode 100644
index 0a3880d..0000000
--- a/test/daemon/notify-i.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#include "notify-i.h"
-#include <hash-helper.h>
-
-using namespace std;
-using namespace boost;
-
-NotifyI::NotifyI (ActionLogPtr &actionLog)
-  : m_actionLog (actionLog)
-{
-}
-
-void
-NotifyI::updateFile (const ::std::string &filename,
-                     const ::std::pair<const Ice::Byte*, const Ice::Byte*> &hashRaw,
-                     ::Ice::Long wtime,
-                     ::Ice::Int mode,
-                     const ::Ice::Current&)
-{
-  Hash hash (hashRaw.first, hashRaw.second-hashRaw.first);
-
-  cout << "updateFile " << filename << " with hash " << hash << endl;
-  try
-    {
-      m_actionLog->AddActionUpdate (filename, hash, wtime, mode);
-
-      m_actionLog->RememberStateInStateLog ();
-    }
-  catch (const boost::exception &e)
-    {
-      cout << "ERRORR: " << *get_error_info<errmsg_info_str> (e) << endl;
-    }
-}
-
-void
-NotifyI::moveFile (const ::std::string &oldFilename,
-                   const ::std::string &newFilename,
-                   const ::Ice::Current&)
-{
-  cout << "moveFile from " << oldFilename << " to " << newFilename << endl;
-  // m_actionLog->AddActionMove (oldFilename, newFilename);
-}
-
-void
-NotifyI::deleteFile (const ::std::string &filename,
-                     const ::Ice::Current&)
-{
-  cout << "deleteFile " << filename << endl;
-  m_actionLog->AddActionDelete (filename);  
-  m_actionLog->RememberStateInStateLog ();
-}
-
diff --git a/test/daemon/notify-i.h b/test/daemon/notify-i.h
deleted file mode 100644
index 426e2a9..0000000
--- a/test/daemon/notify-i.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
- */
-
-#ifndef NOTIFY_I_H
-#define NOTIFY_I_H
-
-#include <action-log.h>
-#include <chronoshare-client.ice.h>
-
-class NotifyI : public ChronoshareClient::Notify
-{
-public:
-  NotifyI (ActionLogPtr &actionLog);
-  
-  virtual void
-  updateFile (const ::std::string &filename,
-              const ::std::pair<const Ice::Byte*, const Ice::Byte*> &hash,
-              ::Ice::Long wtime,
-              ::Ice::Int mode,
-              const ::Ice::Current& = ::Ice::Current());
-
-  virtual void
-  moveFile (const ::std::string &oldFilename,
-            const ::std::string &newFilename,
-            const ::Ice::Current& = ::Ice::Current());
-  
-  virtual void
-  deleteFile (const ::std::string &filename,
-              const ::Ice::Current& = ::Ice::Current());
-
-private:
-  ActionLogPtr m_actionLog;
-};
-
-#endif // NOTIFY_I_H
diff --git a/test/unit-tests/test-event-scheduler.cc b/test/unit-tests/test-event-scheduler.cc
deleted file mode 100644
index 0d70abf..0000000
--- a/test/unit-tests/test-event-scheduler.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "scheduler.h"
-#include "simple-interval-generator.h"
-#include "one-time-task.h"
-#include "periodic-task.h"
-#include "random-interval-generator.h"
-
-#include <boost/test/unit_test.hpp>
-#include <boost/make_shared.hpp>
-#include <map>
-#include <unistd.h>
-
-using namespace boost;
-using namespace std;
-
-BOOST_AUTO_TEST_SUITE(SchedulerTests)
-
-map<string, int> table;
-
-void func(string str)
-{
-  map<string, int>::iterator it = table.find(str);
-  if (it == table.end())
-  {
-    table.insert(make_pair(str, 1));
-  }
-  else
-  {
-    int count = it->second;
-    count++;
-    table.erase(it);
-    table.insert(make_pair(str, count));
-  }
-}
-
-bool
-matcher(const TaskPtr &task)
-{
-  return task->tag() == "period" || task->tag() == "world";
-}
-
-BOOST_AUTO_TEST_CASE(SchedulerTest)
-{
-  SchedulerPtr scheduler(new Scheduler());
-  IntervalGeneratorPtr generator(new SimpleIntervalGenerator(0.2));
-
-  string tag1 = "hello";
-  string tag2 = "world";
-  string tag3 = "period";
-
-  TaskPtr task1(new OneTimeTask(boost::bind(func, tag1), tag1, scheduler, 0.5));
-  TaskPtr task2(new OneTimeTask(boost::bind(func, tag2), tag2, scheduler, 0.5));
-  TaskPtr task3(new PeriodicTask(boost::bind(func, tag3), tag3, scheduler, generator));
-
-  scheduler->start();
-  scheduler->addTask(task1);
-  scheduler->addTask(task2);
-  scheduler->addTask(task3);
-  BOOST_CHECK_EQUAL(scheduler->size(), 3);
-  usleep(600000);
-  BOOST_CHECK_EQUAL(scheduler->size(), 1);
-  scheduler->addTask(task1);
-  BOOST_CHECK_EQUAL(scheduler->size(), 2);
-  usleep(600000);
-  scheduler->addTask(task1);
-  BOOST_CHECK_EQUAL(scheduler->size(), 2);
-  usleep(400000);
-  scheduler->deleteTask(task1->tag());
-  BOOST_CHECK_EQUAL(scheduler->size(), 1);
-  usleep(200000);
-
-  scheduler->addTask(task1);
-  scheduler->addTask(task2);
-  BOOST_CHECK_EQUAL(scheduler->size(), 3);
-  usleep(100000);
-  scheduler->deleteTask(bind(matcher, _1));
-  BOOST_CHECK_EQUAL(scheduler->size(), 1);
-  usleep(1000000);
-
-  BOOST_CHECK_EQUAL(scheduler->size(), 0);
-  scheduler->addTask(task1);
-  usleep(400000);
-  BOOST_CHECK_EQUAL(scheduler->size(), 1);
-  scheduler->rescheduleTask(task1);
-  usleep(400000);
-  BOOST_CHECK_EQUAL(scheduler->size(), 1);
-  usleep(110000);
-  BOOST_CHECK_EQUAL(scheduler->size(), 0);
-
-
-  int hello = 0, world = 0, period = 0;
-
-  map<string, int>::iterator it;
-  it = table.find(tag1);
-  if (it != table.end())
-  {
-    hello = it->second;
-  }
-  it = table.find(tag2);
-  if (it != table.end())
-  {
-    world = it->second;
-  }
-  it = table.find(tag3);
-  if (it != table.end())
-  {
-    period = it->second;
-  }
-
-  // added five times, canceled once before invoking callback
-  BOOST_CHECK_EQUAL(hello, 4);
-  // added two times, canceled once by matcher before invoking callback
-  BOOST_CHECK_EQUAL(world, 1);
-  // invoked every 0.2 seconds before deleted by matcher
-  BOOST_CHECK_EQUAL(period, static_cast<int>((0.6 + 0.6 + 0.4 + 0.2 + 0.1) / 0.2));
-
-  scheduler->shutdown();
-}
-
-void reschedule();
-SchedulerPtr schd0(new Scheduler());
-int resCount;
-TaskPtr task0(new PeriodicTask(boost::bind(reschedule), "testtest", schd0, boost::make_shared<SimpleIntervalGenerator>(0.5)));
-void reschedule()
-{
-  schd0->rescheduleTask(task0);
-  resCount++;
-}
-
-BOOST_AUTO_TEST_CASE(RescheduleTest)
-{
-  resCount = 0;
-  schd0->start();
-  schd0->addTask(task0);
-  usleep(5100000);
-  BOOST_CHECK_EQUAL(resCount, 10);
-  schd0->shutdown();
-}
-
-BOOST_AUTO_TEST_CASE(GeneratorTest)
-{
-  double interval = 10;
-  double percent = 0.5;
-  int times = 10000;
-  IntervalGeneratorPtr generator(new RandomIntervalGenerator(interval, percent));
-  double sum = 0.0;
-  double min = 2 * interval;
-  double max = -1;
-  for (int i = 0; i < times; i++)
-  {
-    double next = generator->nextInterval();
-    sum += next;
-    if (next > max)
-    {
-      max = next;
-    }
-    if (next < min)
-    {
-      min = next;
-    }
-  }
-
-  BOOST_CHECK( abs(1.0 - (sum / static_cast<double>(times)) / interval) < 0.05);
-  BOOST_CHECK( min > interval * (1 - percent / 2.0));
-  BOOST_CHECK( max < interval * (1 + percent / 2.0));
-  BOOST_CHECK( abs(1.0 - ((max - min) / interval) / percent) < 0.05);
-
-}
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/unit-tests/test-executor.cc b/test/unit-tests/test-executor.cc
deleted file mode 100644
index a13f373..0000000
--- a/test/unit-tests/test-executor.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-
-#include <boost/test/unit_test.hpp>
-#include "executor.h"
-
-#include "logging.h"
-
-INIT_LOGGER ("Test.Executor");
-
-using namespace boost;
-using namespace std;
-
-void timeConsumingJob ()
-{
-  _LOG_DEBUG ("Start sleep");
-  sleep(1);
-  _LOG_DEBUG ("Finish sleep");
-}
-
-BOOST_AUTO_TEST_CASE(TestExecutor)
-{
-  INIT_LOGGERS ();
-
-  {
-    Executor executor (3);
-    executor.start ();
-    Executor::Job job = bind(timeConsumingJob);
-
-    executor.execute(job);
-    executor.execute(job);
-
-    usleep(2000);
-    // both jobs should have been taken care of
-    BOOST_CHECK_EQUAL(executor.jobQueueSize(), 0);
-
-    usleep(500000);
-
-    // add four jobs while only one thread is idle
-    executor.execute(job);
-    executor.execute(job);
-    executor.execute(job);
-    executor.execute(job);
-
-    usleep(1000);
-    // three jobs should remain in queue
-    BOOST_CHECK_EQUAL(executor.jobQueueSize(), 3);
-
-    usleep(500000);
-    // two threads should have finished and
-    // take care of two queued jobs
-    BOOST_CHECK_EQUAL(executor.jobQueueSize(), 1);
-
-    // all jobs should have been fetched
-    usleep(501000);
-    BOOST_CHECK_EQUAL(executor.jobQueueSize(), 0);
-
-    executor.shutdown ();
-  } //separate scope to ensure that destructor is called
-
-
-  sleep(1);
-}
diff --git a/test/unit-tests/test-ndnx-name.cc b/test/unit-tests/test-ndnx-name.cc
deleted file mode 100644
index a876ba4..0000000
--- a/test/unit-tests/test-ndnx-name.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-
-#include "ccnx-name.h"
-
-#define BOOST_TEST_MAIN 1
-
-#include <boost/test/unit_test.hpp>
-
-using namespace Ccnx;
-using namespace std;
-using namespace boost;
-
-BOOST_AUTO_TEST_SUITE(CcnxNameTests)
-
-BOOST_AUTO_TEST_CASE (CcnxNameTest)
-{
-  Name empty = Name();
-  Name root = Name("/");
-  BOOST_CHECK_EQUAL(empty, root);
-  BOOST_CHECK_EQUAL(empty, "/");
-  BOOST_CHECK_EQUAL(root.size(), 0);
-  empty.appendComp("hello");
-  empty.appendComp("world");
-  BOOST_CHECK_EQUAL(empty.size(), 2);
-  BOOST_CHECK_EQUAL(empty.toString(), "/hello/world");
-  empty = empty + root;
-  BOOST_CHECK_EQUAL(empty.toString(), "/hello/world");
-  BOOST_CHECK_EQUAL(empty.getCompAsString(0), "hello");
-  BOOST_CHECK_EQUAL(empty.getPartialName(1, 1), Name("/world"));
-  Name name("/hello/world");
-  BOOST_CHECK_EQUAL(empty, name);
-  BOOST_CHECK_EQUAL(name, Name("/hello") + Name("/world"));
-
-
-  name.appendComp (1);
-  name.appendComp (255);
-  name.appendComp (256);
-  name.appendComp (1234567890);
-
-  BOOST_CHECK_EQUAL (name.toString (), "/hello/world/%00%01/%00%ff/%00%00%01/%00%d2%02%96I");
-
-  BOOST_CHECK_EQUAL (name.getCompAsInt (5), 1234567890);
-  BOOST_CHECK_EQUAL (name.getCompAsInt (4), 256);
-  BOOST_CHECK_EQUAL (name.getCompAsInt (3), 255);
-  BOOST_CHECK_EQUAL (name.getCompAsInt (2), 1);
-  
-  // Charbuf related stuff will be checked in other place
-}
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/unit-tests/test-ndnx-wrapper.cc b/test/unit-tests/test-ndnx-wrapper.cc
deleted file mode 100644
index 9989cdb..0000000
--- a/test/unit-tests/test-ndnx-wrapper.cc
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2012 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnx-wrapper.h"
-#include "ccnx-closure.h"
-#include "ccnx-name.h"
-#include "ccnx-selectors.h"
-#include "ccnx-pco.h"
-#include <unistd.h>
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/make_shared.hpp>
-
-using namespace Ccnx;
-using namespace std;
-using namespace boost;
-
-BOOST_AUTO_TEST_SUITE(TestCcnxWrapper)
-
-CcnxWrapperPtr c1;
-CcnxWrapperPtr c2;
-int g_timeout_counter = 0;
-int g_dataCallback_counter = 0;
-
-void publish1(const Name &name)
-{
-  string content = name.toString();
-  c1->publishData(name, (const unsigned char*)content.c_str(), content.size(), 5);
-}
-
-void publish2(const Name &name)
-{
-  string content = name.toString();
-  c2->publishData(name, (const unsigned char*)content.c_str(), content.size(), 5);
-}
-
-void dataCallback(const Name &name, Ccnx::PcoPtr pco)
-{
-  cout << " in data callback" << endl;
-  BytesPtr content = pco->contentPtr ();
-  string msg(reinterpret_cast<const char *> (head (*content)), content->size());
-  g_dataCallback_counter ++;
-  BOOST_CHECK_EQUAL(name, msg);
-}
-
-void encapCallback(const Name &name, Ccnx::PcoPtr pco)
-{
-  cout << " in encap data callback" << endl;
-  BOOST_CHECK(!c1->verify(pco));
-  cout << "++++++++++++++++++ Outer content couldn't be verified, which is expected." << endl;
-  PcoPtr npco = make_shared<ParsedContentObject> (*(pco->contentPtr()));
-  g_dataCallback_counter ++;
-  BOOST_CHECK(npco);
-  BOOST_CHECK(c1->verify(npco));
-}
-
-void
-timeout(const Name &name, const Closure &closure, Selectors selectors)
-{
-  g_timeout_counter ++;
-}
-
-void
-setup()
-{
-  if (!c1)
-  {
-    c1 = make_shared<CcnxWrapper> ();
-  }
-  if (!c2)
-  {
-    c2 = make_shared<CcnxWrapper> ();
-  }
-}
-
-void
-teardown()
-{
-  if (c1)
-  {
-    c1.reset();
-  }
-  if (c2)
-  {
-    c2.reset();
-  }
-}
-
-
-BOOST_AUTO_TEST_CASE (BlaCcnxWrapperTest)
-{
-  INIT_LOGGERS ();
-  
-  setup();
-  Name prefix1("/c1");
-  Name prefix2("/c2");
-
-  c1->setInterestFilter(prefix1, bind(publish1, _1));
-  usleep(100000);
-  c2->setInterestFilter(prefix2, bind(publish2, _1));
-
-  Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
-
-  c1->sendInterest(Name("/c2/hi"), closure);
-  usleep(100000);
-  c2->sendInterest(Name("/c1/hi"), closure);
-  sleep(1);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 2);
-  // reset
-  g_dataCallback_counter = 0;
-  g_timeout_counter = 0;
-
-  teardown();
-}
-
-BOOST_AUTO_TEST_CASE (CcnxWrapperSelector)
-{
-
-  setup();
-  Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
-
-  Selectors selectors;
-  selectors
-    .interestLifetime(1)
-    .childSelector(Selectors::RIGHT);
-
-  string n1 = "/random/01";
-  c1->sendInterest(Name(n1), closure, selectors);
-  sleep(2);
-  c2->publishData(Name(n1), (const unsigned char *)n1.c_str(), n1.size(), 1);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_timeout_counter, 1);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 0);
-
-  string n2 = "/random/02";
-  selectors.interestLifetime(2);
-  c1->sendInterest(Name(n2), closure, selectors);
-  sleep(1);
-  c2->publishData(Name(n2), (const unsigned char *)n2.c_str(), n2.size(), 1);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_timeout_counter, 1);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 1);
-
-  // reset
-  g_dataCallback_counter = 0;
-  g_timeout_counter = 0;
-
-  teardown();
-
-}
-
-void
-reexpress(const Name &name, const Closure &closure, Selectors selectors)
-{
-  g_timeout_counter ++;
-  c1->sendInterest(name, closure, selectors);
-}
-
-BOOST_AUTO_TEST_CASE (TestTimeout)
-{
-  setup();
-  g_dataCallback_counter = 0;
-  g_timeout_counter = 0;
-  Closure closure (bind(dataCallback, _1, _2), bind(reexpress, _1, _2, _3));
-
-  Selectors selectors;
-  selectors.interestLifetime(1);
-
-  string n1 = "/random/04";
-  c1->sendInterest(Name(n1), closure, selectors);
-  usleep(3500000);
-  c2->publishData(Name(n1), (const unsigned char *)n1.c_str(), n1.size(), 1);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 1);
-  BOOST_CHECK_EQUAL(g_timeout_counter, 3);
-  teardown();
-}
-
-BOOST_AUTO_TEST_CASE (TestUnsigned)
-{
-  setup();
-  string n1 = "/xxxxxx/unsigned/01";
-  Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
-
-  g_dataCallback_counter = 0;
-  c1->sendInterest(Name(n1), closure);
-  usleep(100000);
-  c2->publishUnsignedData(Name(n1), (const unsigned char *)n1.c_str(), n1.size(), 1);
-  usleep(100000);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 1);
-
-  string n2 = "/xxxxxx/signed/01";
-  Bytes content = c1->createContentObject(Name(n1), (const unsigned char *)n2.c_str(), n2.size(), 1);
-  c1->publishUnsignedData(Name(n2), head(content), content.size(), 1);
-  Closure encapClosure(bind(encapCallback, _1, _2), bind(timeout, _1, _2, _3));
-  c2->sendInterest(Name(n2), encapClosure);
-  usleep(4000000);
-  BOOST_CHECK_EQUAL(g_dataCallback_counter, 2);
-  teardown();
-}
-
-
- /*
- BOOST_AUTO_TEST_CASE (CcnxWrapperUnsigningTest)
- {
-   setup();
-   Bytes data;
-   data.resize(1024);
-   for (int i = 0; i < 1024; i++)
-   {
-     data[i] = 'm';
-   }
-
-   Name name("/unsigningtest");
-
-   posix_time::ptime start = posix_time::second_clock::local_time();
-   for (uint64_t i = 0; i < 100000; i++)
-   {
-     Name n = name;
-     n.appendComp(i);
-     c1->publishUnsignedData(n, data, 10);
-   }
-   posix_time::ptime end = posix_time::second_clock::local_time();
-
-   posix_time::time_duration duration = end - start;
-
-   cout << "Publishing 100000 1K size content objects costs " <<duration.total_milliseconds() << " milliseconds" << endl;
-   cout << "Average time to publish one content object is " << (double) duration.total_milliseconds() / 100000.0 << " milliseconds" << endl;
-    teardown();
- }
- */
-
-
-BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/main.cpp b/tests/main.cpp
similarity index 97%
rename from test/main.cpp
rename to tests/main.cpp
index 9aeb059..4abe5de 100644
--- a/test/main.cpp
+++ b/tests/main.cpp
@@ -17,8 +17,9 @@
  *
  * See AUTHORS.md for complete list of ChronoShare authors and contributors.
  */
-
 #define BOOST_TEST_MAIN 1
 #define BOOST_TEST_DYN_LINK 1
+#include "test-common.hpp"
+
 
 #include <boost/test/unit_test.hpp>
diff --git a/test/unit-tests/test-action-log.cc b/tests/unit-tests/action-log.t.cpp
similarity index 100%
rename from test/unit-tests/test-action-log.cc
rename to tests/unit-tests/action-log.t.cpp
diff --git a/test/unit-tests/test-dispatcher.cc b/tests/unit-tests/dispatcher.t.cpp
similarity index 100%
rename from test/unit-tests/test-dispatcher.cc
rename to tests/unit-tests/dispatcher.t.cpp
diff --git a/test/unit-tests/test-fetch-manager.cc b/tests/unit-tests/fetch-manager.t.cpp
similarity index 100%
rename from test/unit-tests/test-fetch-manager.cc
rename to tests/unit-tests/fetch-manager.t.cpp
diff --git a/test/unit-tests/test-fetch-task-db.cc b/tests/unit-tests/fetch-task-db.t.cpp
similarity index 100%
rename from test/unit-tests/test-fetch-task-db.cc
rename to tests/unit-tests/fetch-task-db.t.cpp
diff --git a/test/unit-tests/test-fs-watcher-delay.cc b/tests/unit-tests/fs-watcher-delay.t.cpp
similarity index 100%
rename from test/unit-tests/test-fs-watcher-delay.cc
rename to tests/unit-tests/fs-watcher-delay.t.cpp
diff --git a/test/unit-tests/test-fs-watcher.cc b/tests/unit-tests/fs-watcher.t.cpp
similarity index 100%
rename from test/unit-tests/test-fs-watcher.cc
rename to tests/unit-tests/fs-watcher.t.cpp
diff --git a/test/unit-tests/test-object-manager.cc b/tests/unit-tests/object-manager.t.cpp
similarity index 100%
rename from test/unit-tests/test-object-manager.cc
rename to tests/unit-tests/object-manager.t.cpp
diff --git a/test/unit-tests/test-protobuf.cc b/tests/unit-tests/protobuf.t.cpp
similarity index 100%
rename from test/unit-tests/test-protobuf.cc
rename to tests/unit-tests/protobuf.t.cpp
diff --git a/test/unit-tests/test-serve-and-fetch.cc b/tests/unit-tests/serve-and-fetch.t.cpp
similarity index 100%
rename from test/unit-tests/test-serve-and-fetch.cc
rename to tests/unit-tests/serve-and-fetch.t.cpp
diff --git a/test/unit-tests/test-sync-core.cc b/tests/unit-tests/sync-core.t.cpp
similarity index 100%
rename from test/unit-tests/test-sync-core.cc
rename to tests/unit-tests/sync-core.t.cpp
diff --git a/test/unit-tests/test-sync-log.cc b/tests/unit-tests/sync-log.t.cpp
similarity index 100%
rename from test/unit-tests/test-sync-log.cc
rename to tests/unit-tests/sync-log.t.cpp
diff --git a/test/wscript b/tests/wscript
similarity index 100%
rename from test/wscript
rename to tests/wscript
diff --git a/wscript b/wscript
index 8db6afa..a0115e7 100644
--- a/wscript
+++ b/wscript
@@ -207,7 +207,7 @@
 #         )
     Logs.error("dump-db app compilation is temporary disabled")
 
-    bld.recurse('test');
+    bld.recurse('tests');
 
 from waflib import TaskGen
 @TaskGen.extension('.mm')
