diff --git a/src/action-log.cpp b/src/action-log.cpp
index 179be79..7dbc663 100644
--- a/src/action-log.cpp
+++ b/src/action-log.cpp
@@ -19,13 +19,13 @@
  */
 
 #include "action-log.hpp"
-#include "logging.hpp"
+#include "sync-core.hpp"
+#include "core/logging.hpp"
 
-#include <boost/make_shared.hpp>
+#include <ndn-cxx/util/string-helper.hpp>
 
-using namespace boost;
-using namespace std;
-using namespace Ndnx;
+namespace ndn {
+namespace chronoshare {
 
 _LOG_INIT(ActionLog);
 
@@ -78,7 +78,8 @@
         SELECT apply_action (NEW.device_name, NEW.seq_no,               \
                              NEW.action,NEW.filename,NEW.version,NEW.file_hash,     \
                              strftime('%s', NEW.file_atime),strftime('%s', NEW.file_mtime),strftime('%s', NEW.file_ctime), \
-                             NEW.file_chmod, NEW.file_seg_num); /* function that applies action and adds record the FileState */  \n \
+                             NEW.file_chmod, NEW.file_seg_num);         \n\
+                             /* function that applies action and adds record the FileState */ \n\
     END;                                                                \n\
 ";
 
@@ -88,13 +89,13 @@
 //   _LOG_TRACE("SQLITE: " << q);
 // }
 
-ActionLog::ActionLog(Ccnx::CcnxWrapperPtr ccnx, const boost::filesystem::path& path,
-                     SyncLogPtr syncLog, const std::string& sharedFolder,
-                     const std::string& appName, OnFileAddedOrChangedCallback onFileAddedOrChanged,
+ActionLog::ActionLog(Face& face, const boost::filesystem::path& path, SyncLogPtr syncLog,
+                     const std::string& sharedFolder, const std::string& appName,
+                     OnFileAddedOrChangedCallback onFileAddedOrChanged,
                      OnFileRemovedCallback onFileRemoved)
   : DbHelper(path / ".chronoshare", "action-log.db")
   , m_syncLog(syncLog)
-  , m_ccnx(ccnx)
+  // , m_face(face)
   , m_sharedFolderName(sharedFolder)
   , m_appName(appName)
   , m_onFileAddedOrChanged(onFileAddedOrChanged)
@@ -110,13 +111,13 @@
     sqlite3_create_function(m_db, "apply_action", -1, SQLITE_ANY, reinterpret_cast<void*>(this),
                             ActionLog::apply_action_xFun, 0, 0);
   if (res != SQLITE_OK) {
-    BOOST_THROW_EXCEPTION(Error::Db() << errmsg_info_str("Cannot create function ``apply_action''"));
+    BOOST_THROW_EXCEPTION(Error("Cannot create function ``apply_action''"));
   }
 
   m_fileState = make_shared<FileState>(path);
 }
 
-tuple<sqlite3_int64 /*version*/, Ccnx::CcnxCharbufPtr /*device name*/, sqlite3_int64 /*seq_no*/>
+std::tuple<sqlite3_int64 /*version*/, BufferPtr /*device name*/, sqlite3_int64 /*seq_no*/>
 ActionLog::GetLatestActionForFile(const std::string& filename)
 {
   // check if something already exists
@@ -127,11 +128,11 @@
                                -1, &stmt, 0);
 
   if (res != SQLITE_OK) {
-    BOOST_THROW_EXCEPTION(Error::Db() << errmsg_info_str("Some error with GetExistingRecord"));
+    BOOST_THROW_EXCEPTION(Error("Some error with GetExistingRecord"));
   }
 
   sqlite3_int64 version = -1;
-  NdnxCharbufPtr parent_device_name;
+  BufferPtr parent_device_name;
   sqlite3_int64 parent_seq_no = -1;
 
   sqlite3_bind_text(stmt, 1, filename.c_str(), filename.size(), SQLITE_STATIC);
@@ -141,32 +142,30 @@
     if (sqlite3_column_int(stmt, 3) == 0) // prevent "linking" if the file was previously deleted
     {
       parent_device_name =
-        make_shared<CcnxCharbuf>(sqlite3_column_blob(stmt, 1), sqlite3_column_bytes(stmt, 1));
+        std::make_shared<Buffer>(sqlite3_column_blob(stmt, 1), sqlite3_column_bytes(stmt, 1));
       parent_seq_no = sqlite3_column_int64(stmt, 2);
     }
   }
 
   sqlite3_finalize(stmt);
-  return make_tuple(version, parent_device_name, parent_seq_no);
+  return std::make_tuple(version, parent_device_name, parent_seq_no);
 }
 
 // local add action. remote action is extracted from content object
 ActionItemPtr
-ActionLog::AddLocalActionUpdate(const std::string& filename,
-                                const Hash& hash,
-                                time_t wtime,
-                                int mode,
-                                int seg_num)
+ActionLog::AddLocalActionUpdate(const std::string& filename, const Buffer& hash, time_t wtime,
+                                int mode, int seg_num)
 {
   sqlite3_exec(m_db, "BEGIN TRANSACTION;", 0, 0, 0);
 
-  CcnxCharbufPtr device_name = m_syncLog->GetLocalName().toCcnxCharbuf();
+  Block device_name = m_syncLog->GetLocalName().wireEncode();
+
   sqlite3_int64 seq_no = m_syncLog->GetNextLocalSeqNo();
   sqlite3_int64 version;
-  CcnxCharbufPtr parent_device_name;
+  BufferPtr parent_device_name;
   sqlite3_int64 parent_seq_no = -1;
 
-  sqlite3_int64 action_time = time(0);
+  sqlite3_int64 action_time = std::time(0);
 
   tie(version, parent_device_name, parent_seq_no) = GetLatestActionForFile(filename);
   version++;
@@ -188,27 +187,26 @@
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
   if (res != SQLITE_OK) {
-    BOOST_THROW_EXCEPTION(Error::Db() << errmsg_info_str(sqlite3_errmsg(m_db)));
+    BOOST_THROW_EXCEPTION(Error(sqlite3_errmsg(m_db)));
   }
 
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, device_name.wire(), device_name.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seq_no);
   sqlite3_bind_int(stmt, 3, 0);
   sqlite3_bind_text(stmt, 4, filename.c_str(), filename.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 5, version);
   sqlite3_bind_int64(stmt, 6, action_time);
 
-  sqlite3_bind_blob(stmt, 7, hash.GetHash(), hash.GetHashBytes(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 7, hash.buf(), hash.size(), SQLITE_STATIC);
 
-  // sqlite3_bind_int64 (stmt, 8, atime); // NULL
+  // sqlite3_bind_int64(stmt, 8, atime); // NULL
   sqlite3_bind_int64(stmt, 9, wtime);
-  // sqlite3_bind_int64 (stmt, 10, ctime); // NULL
+  // sqlite3_bind_int64(stmt, 10, ctime); // NULL
   sqlite3_bind_int(stmt, 11, mode);
   sqlite3_bind_int(stmt, 12, seg_num);
 
   if (parent_device_name && parent_seq_no > 0) {
-    sqlite3_bind_blob(stmt, 13, parent_device_name->buf(), parent_device_name->length(),
-                      SQLITE_STATIC);
+    sqlite3_bind_blob(stmt, 13, parent_device_name->buf(), parent_device_name->size(), SQLITE_STATIC);
     sqlite3_bind_int64(stmt, 14, parent_seq_no);
   }
 
@@ -217,38 +215,44 @@
   item->set_filename(filename);
   item->set_version(version);
   item->set_timestamp(action_time);
-  item->set_file_hash(hash.GetHash(), hash.GetHashBytes());
-  // item->set_atime (atime);
+  item->set_file_hash(hash.buf(), hash.size());
+  // item->set_atime(atime);
   item->set_mtime(wtime);
-  // item->set_ctime (ctime);
+  // item->set_ctime(ctime);
   item->set_mode(mode);
   item->set_seg_num(seg_num);
 
   if (parent_device_name && parent_seq_no > 0) {
-    // cout << Name (*parent_device_name) << endl;
+    // cout << Name(*parent_device_name) << endl;
 
-    item->set_parent_device_name(parent_device_name->buf(), parent_device_name->length());
+    item->set_parent_device_name(parent_device_name->buf(), parent_device_name->size());
     item->set_parent_seq_no(parent_seq_no);
   }
 
   // assign name to the action, serialize action, and create content object
 
-
-  string item_msg;
+  std::string item_msg;
   item->SerializeToString(&item_msg);
 
   // action name: /<device_name>/<appname>/action/<shared-folder>/<action-seq>
-  Name actionName =
-    Name("/")(m_syncLog->GetLocalName())(m_appName)("action")(m_sharedFolderName)(seq_no);
+
+  Name actionName = Name("/");
+  actionName.append(m_syncLog->GetLocalName()).append(m_appName).append("action");
+  actionName.append(m_sharedFolderName).appendNumber(seq_no);
   _LOG_DEBUG("ActionName: " << actionName);
 
-  Bytes actionData = m_ccnx->createContentObject(actionName, item_msg.c_str(), item_msg.size());
-  CcnxCharbufPtr namePtr = actionName.toCcnxCharbuf();
+  shared_ptr<Data> actionData = make_shared<Data>();
+  actionData->setName(actionName);
+  actionData->setFreshnessPeriod(time::seconds(60));
+  actionData->setContent(reinterpret_cast<const uint8_t*>(item_msg.c_str()), item_msg.size());
+  m_keyChain.sign(*actionData);
 
-  // _LOG_DEBUG (" >>>>>>> " << Name (namePtr->buf () << " " << namePtr->length ());
+  // _LOG_DEBUG(" >>>>>>> " << Name(namePtr->buf() << " " << namePtr->length());
 
-  sqlite3_bind_blob(stmt, 15, namePtr->buf(), namePtr->length(), SQLITE_STATIC);
-  sqlite3_bind_blob(stmt, 16, head(actionData), actionData.size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 15, actionName.wireEncode().wire(), actionName.wireEncode().size(),
+                    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 16, actionData->wireEncode().wire(), actionData->wireEncode().size(),
+                    SQLITE_STATIC);
 
   sqlite3_step(stmt);
 
@@ -262,7 +266,7 @@
                      -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, device_name.wire(), device_name.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seq_no);
   sqlite3_step(stmt);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_DONE, sqlite3_errmsg(m_db));
@@ -278,11 +282,10 @@
 }
 
 // void
-// ActionLog::AddActionMove (const std::string &oldFile, const std::string &newFile)
+// ActionLog::AddActionMove(const std::string &oldFile, const std::string &newFile)
 // {
 //   // not supported yet
-//   BOOST_THROW_EXCEPTION (Error::Db ()
-//                          << errmsg_info_str ("Move operation is not yet supported"));
+//   BOOST_THROW_EXCEPTION(Error("Move operation is not yet supported"));
 // }
 
 ActionItemPtr
@@ -292,12 +295,12 @@
 
   sqlite3_exec(m_db, "BEGIN TRANSACTION;", 0, 0, 0);
 
-  CcnxCharbufPtr device_name = m_syncLog->GetLocalName().toCcnxCharbuf();
+  const Block device_name = m_syncLog->GetLocalName().wireEncode();
   sqlite3_int64 version;
-  CcnxCharbufPtr parent_device_name;
+  BufferPtr parent_device_name;
   sqlite3_int64 parent_seq_no = -1;
 
-  sqlite3_int64 action_time = time(0);
+  sqlite3_int64 action_time = std::time(0);
 
   tie(version, parent_device_name, parent_seq_no) = GetLatestActionForFile(filename);
   if (!parent_device_name) // no records exist or file was already deleted
@@ -327,12 +330,12 @@
                            "(device_name, seq_no, action, filename, version, action_timestamp, "
                            "parent_device_name, parent_seq_no, "
                            "action_name, action_content_object) "
-                           "VALUES (?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
+                           "VALUES(?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
                            "        ?, ?,"
                            "        ?, ?)",
                      -1, &stmt, 0);
 
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, device_name.wire(), device_name.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seq_no);
   sqlite3_bind_int(stmt, 3, 1);
   sqlite3_bind_text(stmt, 4, filename.c_str(), filename.size(), SQLITE_STATIC); // file
@@ -340,7 +343,7 @@
   sqlite3_bind_int64(stmt, 5, version);
   sqlite3_bind_int64(stmt, 6, action_time);
 
-  sqlite3_bind_blob(stmt, 7, parent_device_name->buf(), parent_device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 7, parent_device_name->buf(), parent_device_name->size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 8, parent_seq_no);
 
   ActionItemPtr item = make_shared<ActionItem>();
@@ -348,28 +351,34 @@
   item->set_filename(filename);
   item->set_version(version);
   item->set_timestamp(action_time);
-  item->set_parent_device_name(parent_device_name->buf(), parent_device_name->length());
+  item->set_parent_device_name(parent_device_name->buf(), parent_device_name->size());
   item->set_parent_seq_no(parent_seq_no);
 
-  string item_msg;
+  std::string item_msg;
   item->SerializeToString(&item_msg);
 
   // action name: /<device_name>/<appname>/action/<shared-folder>/<action-seq>
-  Name actionName =
-    Name("/")(m_syncLog->GetLocalName())(m_appName)("action")(m_sharedFolderName)(seq_no);
+  Name actionName = Name("/");
+  actionName.append(m_syncLog->GetLocalName()).append(m_appName).append("action");
+  actionName.append(m_sharedFolderName).appendNumber(seq_no);
   _LOG_DEBUG("ActionName: " << actionName);
 
-  Bytes actionData = m_ccnx->createContentObject(actionName, item_msg.c_str(), item_msg.size());
-  CcnxCharbufPtr namePtr = actionName.toCcnxCharbuf();
+  shared_ptr<Data> actionData = make_shared<Data>();
+  actionData->setName(actionName);
+  actionData->setFreshnessPeriod(time::seconds(60));
+  actionData->setContent(reinterpret_cast<const uint8_t*>(item_msg.c_str()), item_msg.size());
+  m_keyChain.sign(*actionData);
 
-  sqlite3_bind_blob(stmt, 9, namePtr->buf(), namePtr->length(), SQLITE_STATIC);
-  sqlite3_bind_blob(stmt, 10, &actionData[0], actionData.size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 9, actionName.wireEncode().wire(), actionName.wireEncode().size(),
+                    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 10, actionData->wireEncode().wire(), actionData->wireEncode().size(),
+                    SQLITE_STATIC);
 
   sqlite3_step(stmt);
 
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_DONE, sqlite3_errmsg(m_db));
 
-  // cout << Ndnx::Name (parent_device_name) << endl;
+  // cout << Name(parent_device_name) << endl;
 
   // assign name to the action, serialize action, and create content object
 
@@ -381,7 +390,7 @@
                      -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, device_name.wire(), device_name.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seq_no);
   sqlite3_step(stmt);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_DONE, sqlite3_errmsg(m_db));
@@ -393,68 +402,68 @@
   return item;
 }
 
-
-PcoPtr
-ActionLog::LookupActionPco(const Ccnx::Name& deviceName, sqlite3_int64 seqno)
+shared_ptr<Data>
+ActionLog::LookupActionData(const Name& deviceName, sqlite3_int64 seqno)
 {
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_db,
                      "SELECT action_content_object FROM ActionLog WHERE device_name=? AND seq_no=?",
                      -1, &stmt, 0);
 
-  CcnxCharbufPtr name = deviceName.toCcnxCharbuf();
-
-  sqlite3_bind_blob(stmt, 1, name->buf(), name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, deviceName.wireEncode().wire(), deviceName.wireEncode().size(),
+                    SQLITE_STATIC); // ndn version
   sqlite3_bind_int64(stmt, 2, seqno);
 
-  PcoPtr retval;
+  shared_ptr<Data> retval;
+
   if (sqlite3_step(stmt) == SQLITE_ROW) {
-    // _LOG_DEBUG (sqlite3_column_blob (stmt, 0) << ", " << sqlite3_column_bytes (stmt, 0));
-    retval = make_shared<ParsedContentObject>(reinterpret_cast<const unsigned char*>(
-                                                sqlite3_column_blob(stmt, 0)),
-                                              sqlite3_column_bytes(stmt, 0));
+    // _LOG_DEBUG(sqlite3_column_blob(stmt, 0) << ", " << sqlite3_column_bytes(stmt, 0));
+    retval = make_shared<Data>();
+    retval->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(stmt, 0)),
+                             sqlite3_column_bytes(stmt, 0)));
   }
   else {
     _LOG_TRACE("No action found for deviceName [" << deviceName << "] and seqno:" << seqno);
   }
-  // _LOG_DEBUG_COND (sqlite3_errcode (m_db) != SQLITE_OK && sqlite3_errcode (m_db) != SQLITE_ROW, sqlite3_errmsg (m_db));
+  // _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK && sqlite3_errcode(m_db) != SQLITE_ROW,
+  // sqlite3_errmsg(m_db));
   sqlite3_finalize(stmt);
 
   return retval;
 }
 
 ActionItemPtr
-ActionLog::LookupAction(const Ccnx::Name& deviceName, sqlite3_int64 seqno)
+ActionLog::LookupAction(const Name& deviceName, sqlite3_int64 seqno)
 {
-  PcoPtr pco = LookupActionPco(deviceName, seqno);
-  if (!pco)
+  shared_ptr<Data> data = LookupActionData(deviceName, seqno);
+  if (!data)
     return ActionItemPtr();
 
-  ActionItemPtr action = deserializeMsg<ActionItem>(pco->content());
-
+  ActionItemPtr action =
+    deserializeMsg<ActionItem>(Buffer(data->getContent().value(), data->getContent().value_size()));
   return action;
 }
 
-Ccnx::PcoPtr
-ActionLog::LookupActionPco(const Ccnx::Name& actionName)
+shared_ptr<Data>
+ActionLog::LookupActionData(const Name& actionName)
 {
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_db, "SELECT action_content_object FROM ActionLog WHERE action_name=?", -1,
                      &stmt, 0);
 
   _LOG_DEBUG(actionName);
-  CcnxCharbufPtr name = actionName.toCcnxCharbuf();
 
-  _LOG_DEBUG(" <<<<<<< " << name->buf() << " " << name->length());
+  _LOG_DEBUG(" LookActionData <<<<<<< " << actionName << " " << actionName.wireEncode().size());
 
-  sqlite3_bind_blob(stmt, 1, name->buf(), name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, actionName.wireEncode().wire(), actionName.wireEncode().size(),
+                    SQLITE_STATIC);
 
-  PcoPtr retval;
+  shared_ptr<Data> retval; // = make_shared<Data>();
   if (sqlite3_step(stmt) == SQLITE_ROW) {
-    // _LOG_DEBUG (sqlite3_column_blob (stmt, 0) << ", " << sqlite3_column_bytes (stmt, 0));
-    retval = make_shared<ParsedContentObject>(reinterpret_cast<const unsigned char*>(
-                                                sqlite3_column_blob(stmt, 0)),
-                                              sqlite3_column_bytes(stmt, 0));
+    // _LOG_DEBUG(sqlite3_column_blob(stmt, 0) << ", " << sqlite3_column_bytes(stmt, 0));
+    retval = make_shared<Data>();
+    retval->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(stmt, 0)),
+                             sqlite3_column_bytes(stmt, 0)));
   }
   else {
     _LOG_TRACE("No action found for name: " << actionName);
@@ -466,19 +475,20 @@
 }
 
 ActionItemPtr
-ActionLog::LookupAction(const Ccnx::Name& actionName)
+ActionLog::LookupAction(const Name& actionName)
 {
-  PcoPtr pco = LookupActionPco(actionName);
-  if (!pco)
+  shared_ptr<Data> data = LookupActionData(actionName);
+  if (!data)
     return ActionItemPtr();
 
-  ActionItemPtr action = deserializeMsg<ActionItem>(pco->content());
+  ActionItemPtr action =
+    deserializeMsg<ActionItem>(Buffer(data->getContent().value(), data->getContent().value_size()));
 
   return action;
 }
 
 FileItemPtr
-ActionLog::LookupAction(const std::string& filename, sqlite3_int64 version, const Hash& filehash)
+ActionLog::LookupAction(const std::string& filename, sqlite3_int64 version, const Buffer& filehash)
 {
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_db,
@@ -487,13 +497,13 @@
                      " WHERE action = 0 AND "
                      "       filename=? AND "
                      "       version=? AND "
-                     "       is_prefix (?, file_hash)=1",
+                     "       is_prefix(?, file_hash)=1",
                      -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
   sqlite3_bind_text(stmt, 1, filename.c_str(), filename.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, version);
-  sqlite3_bind_blob(stmt, 3, filehash.GetHash(), filehash.GetHashBytes(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 3, filehash.buf(), filehash.size(), SQLITE_STATIC);
 
   FileItemPtr fileItem;
 
@@ -518,38 +528,38 @@
 
 
 ActionItemPtr
-ActionLog::AddRemoteAction(const Ccnx::Name& deviceName, sqlite3_int64 seqno, Ccnx::PcoPtr actionPco)
+ActionLog::AddRemoteAction(const Name& deviceName, sqlite3_int64 seqno, shared_ptr<Data> actionData)
 {
-  if (!actionPco) {
-    _LOG_ERROR("actionPco is not valid");
+  if (!actionData) {
+    _LOG_ERROR("actionData is not valid");
     return ActionItemPtr();
   }
-  ActionItemPtr action = deserializeMsg<ActionItem>(actionPco->content());
+  ActionItemPtr action = deserializeMsg<ActionItem>(
+    Buffer(actionData->getContent().value(), actionData->getContent().value_size()));
 
   if (!action) {
     _LOG_ERROR("action cannot be decoded");
     return ActionItemPtr();
   }
 
-  _LOG_DEBUG("AddRemoteAction: [" << deviceName << "] seqno: " << seqno);
+  _LOG_DEBUG("AddRemoteAction: [" << deviceName.toUri() << "] seqno: " << seqno);
 
   sqlite3_stmt* stmt;
-  int res =
-    sqlite3_prepare_v2(m_db,
-                       "INSERT INTO ActionLog "
-                       "(device_name, seq_no, action, filename, version, action_timestamp, "
-                       "file_hash, file_atime, file_mtime, file_ctime, file_chmod, file_seg_num, "
-                       "parent_device_name, parent_seq_no, "
-                       "action_name, action_content_object) "
-                       "VALUES (?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
-                       "        ?, datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), ?,?, "
-                       "        ?, ?, "
-                       "        ?, ?);",
-                       -1, &stmt, 0);
+  sqlite3_prepare_v2(m_db,
+                     "INSERT INTO ActionLog "
+                     "(device_name, seq_no, action, filename, version, action_timestamp, "
+                     "file_hash, file_atime, file_mtime, file_ctime, file_chmod, file_seg_num, "
+                     "parent_device_name, parent_seq_no, "
+                     "action_name, action_content_object) "
+                     "VALUES (?, ?, ?, ?, ?, datetime(?, 'unixepoch'),"
+                     "        ?, datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), ?,?, "
+                     "        ?, ?, "
+                     "        ?, ?);",
+                     -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
-  CcnxCharbufPtr device_name = deviceName.toCcnxCharbuf();
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, deviceName.wireEncode().wire(), deviceName.wireEncode().size(),
+                    SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seqno);
 
   sqlite3_bind_int(stmt, 3, action->action());
@@ -561,9 +571,9 @@
     sqlite3_bind_blob(stmt, 7, action->file_hash().c_str(), action->file_hash().size(),
                       SQLITE_STATIC);
 
-    // sqlite3_bind_int64 (stmt, 8, atime); // NULL
+    // sqlite3_bind_int64(stmt, 8, atime); // NULL
     sqlite3_bind_int64(stmt, 9, action->mtime());
-    // sqlite3_bind_int64 (stmt, 10, ctime); // NULL
+    // sqlite3_bind_int64(stmt, 10, ctime); // NULL
 
     sqlite3_bind_int(stmt, 11, action->mode());
     sqlite3_bind_int(stmt, 12, action->seg_num());
@@ -575,11 +585,13 @@
     sqlite3_bind_int64(stmt, 14, action->parent_seq_no());
   }
 
-  Name actionName = Name(deviceName)("action")(m_sharedFolderName)(seqno);
-  CcnxCharbufPtr namePtr = actionName.toCcnxCharbuf();
+  Name actionName = Name(deviceName);
+  actionName.append("action").append(m_sharedFolderName).appendNumber(seqno);
 
-  sqlite3_bind_blob(stmt, 15, namePtr->buf(), namePtr->length(), SQLITE_STATIC);
-  sqlite3_bind_blob(stmt, 16, head(actionPco->buf()), actionPco->buf().size(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 15, actionName.wireEncode().wire(), actionName.wireEncode().size(),
+                    SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 16, actionData->wireEncode().wire(), actionData->wireEncode().size(),
+                    SQLITE_STATIC);
   sqlite3_step(stmt);
 
   // if action needs to be applied to file state, the trigger will take care of it
@@ -594,7 +606,8 @@
                      -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
-  sqlite3_bind_blob(stmt, 1, device_name->buf(), device_name->length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, deviceName.wireEncode().wire(), deviceName.wireEncode().size(),
+                    SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seqno);
   sqlite3_step(stmt);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_DONE, sqlite3_errmsg(m_db));
@@ -605,40 +618,40 @@
 }
 
 ActionItemPtr
-ActionLog::AddRemoteAction(Ccnx::PcoPtr actionPco)
+ActionLog::AddRemoteAction(shared_ptr<Data> actionData)
 {
-  Name name = actionPco->name();
+  Name name = actionData->getName();
   // action name: /<device_name>/<appname>/action/<shared-folder>/<action-seq>
 
-  uint64_t seqno = name.getCompFromBackAsInt(0);
-  string sharedFolder = name.getCompFromBackAsString(1);
+  uint64_t seqno = name.get(-1).toNumber();
+  std::string sharedFolder = name.get(-2).toUri();
 
   if (sharedFolder != m_sharedFolderName) {
     _LOG_ERROR("Action doesn't belong to this shared folder");
     return ActionItemPtr();
   }
 
-  string action = name.getCompFromBackAsString(2);
+  std::string action = name.get(-3).toUri();
 
   if (action != "action") {
     _LOG_ERROR("not an action");
     return ActionItemPtr();
   }
 
-  string appName = name.getCompFromBackAsString(3);
+  std::string appName = name.get(-4).toUri();
   if (appName != m_appName) {
     _LOG_ERROR("Action doesn't belong to this application");
     return ActionItemPtr();
   }
 
-  Name deviceName = name.getPartialName(0, name.size() - 4);
+  Name deviceName = name.getSubName(0, name.size() - 4);
 
   _LOG_DEBUG("From [" << name << "] extracted deviceName: " << deviceName << ", sharedFolder: "
                       << sharedFolder
                       << ", seqno: "
                       << seqno);
 
-  return AddRemoteAction(deviceName, seqno, actionPco);
+  return AddRemoteAction(deviceName, seqno, actionData);
 }
 
 sqlite3_int64
@@ -655,10 +668,9 @@
   return retval;
 }
 
-
 bool
 ActionLog::LookupActionsInFolderRecursively(
-  const boost::function<void(const Ccnx::Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
+  const function<void(const Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
   const std::string& folder, int offset /*=0*/, int limit /*=-1*/)
 {
   _LOG_DEBUG("LookupActionsInFolderRecursively: [" << folder << "]");
@@ -709,7 +721,9 @@
 
     ActionItem action;
 
-    Ccnx::Name device_name(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0));
+    Name device_name(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(stmt, 0)),
+                           sqlite3_column_bytes(stmt, 0)));
+
     sqlite3_int64 seq_no = sqlite3_column_int64(stmt, 1);
     action.set_action(static_cast<ActionItem_ActionType>(sqlite3_column_int(stmt, 2)));
     action.set_filename(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 3)),
@@ -746,7 +760,7 @@
  */
 bool
 ActionLog::LookupActionsForFile(
-  const boost::function<void(const Ccnx::Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
+  const function<void(const Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
   const std::string& file, int offset /*=0*/, int limit /*=-1*/)
 {
   _LOG_DEBUG("LookupActionsInFolderRecursively: [" << file << "]");
@@ -783,7 +797,9 @@
 
     ActionItem action;
 
-    Ccnx::Name device_name(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0));
+    Name device_name(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(stmt, 0)),
+                           sqlite3_column_bytes(stmt, 0)));
+
     sqlite3_int64 seq_no = sqlite3_column_int64(stmt, 1);
     action.set_action(static_cast<ActionItem_ActionType>(sqlite3_column_int(stmt, 2)));
     action.set_filename(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 3)),
@@ -815,9 +831,8 @@
   return (limit == 1); // more data is available
 }
 
-
 void
-ActionLog::LookupRecentFileActions(const boost::function<void(const string&, int, int)>& visitor,
+ActionLog::LookupRecentFileActions(const function<void(const std::string&, int, int)>& visitor,
                                    int limit)
 {
   sqlite3_stmt* stmt;
@@ -864,25 +879,31 @@
     return;
   }
 
-  CcnxCharbuf device_name(sqlite3_value_blob(argv[0]), sqlite3_value_bytes(argv[0]));
+  Buffer device_name(sqlite3_value_blob(argv[0]), sqlite3_value_bytes(argv[0]));
   sqlite3_int64 seq_no = sqlite3_value_int64(argv[1]);
   int action = sqlite3_value_int(argv[2]);
-  string filename = reinterpret_cast<const char*>(sqlite3_value_text(argv[3]));
+  std::string filename = reinterpret_cast<const char*>(sqlite3_value_text(argv[3]));
   sqlite3_int64 version = sqlite3_value_int64(argv[4]);
 
   _LOG_TRACE("apply_function called with " << argc);
-  _LOG_TRACE("device_name: " << Name(device_name) << ", action: " << action << ", file: " << filename);
+  _LOG_TRACE("device_name: " << Name(Block(reinterpret_cast<const char*>(device_name.buf()),
+                                           device_name.size()))
+                             << ", action: "
+                             << action
+                             << ", file: "
+                             << filename);
 
   if (action == 0) // update
   {
-    Hash hash(sqlite3_value_blob(argv[5]), sqlite3_value_bytes(argv[5]));
+    Buffer hash(sqlite3_value_blob(argv[5]), sqlite3_value_bytes(argv[5]));
     time_t atime = static_cast<time_t>(sqlite3_value_int64(argv[6]));
     time_t mtime = static_cast<time_t>(sqlite3_value_int64(argv[7]));
     time_t ctime = static_cast<time_t>(sqlite3_value_int64(argv[8]));
     int mode = sqlite3_value_int(argv[9]);
     int seg_num = sqlite3_value_int(argv[10]);
 
-    _LOG_DEBUG("Update " << filename << " " << atime << " " << mtime << " " << ctime << " " << hash);
+    _LOG_DEBUG("Update " << filename << " " << atime << " " << mtime << " " << ctime << " "
+                         << toHex(hash));
 
     the->m_fileState->UpdateFile(filename, version, hash, device_name, seq_no, atime, mtime, ctime,
                                  mode, seg_num);
@@ -898,3 +919,6 @@
 
   sqlite3_result_null(context);
 }
+
+} // namespace chronoshare
+} // namespace ndn
diff --git a/src/action-log.hpp b/src/action-log.hpp
index 80f354c..99bcb0e 100644
--- a/src/action-log.hpp
+++ b/src/action-log.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -18,34 +18,48 @@
  * See AUTHORS.md for complete list of ChronoShare authors and contributors.
  */
 
-#ifndef ACTION_LOG_H
-#define ACTION_LOG_H
+#ifndef CHRONOSHARE_SRC_ACTION_LOG_HPP
+#define CHRONOSHARE_SRC_ACTION_LOG_HPP
 
-#include "action-item.pb.hpp"
-#include "ccnx-pco.hpp"
-#include "ccnx-wrapper.hpp"
 #include "db-helper.hpp"
-#include "file-item.pb.hpp"
 #include "file-state.hpp"
 #include "sync-log.hpp"
+#include "core/chronoshare-common.hpp"
 
-#include <boost/tuple/tuple.hpp>
+#include "action-item.pb.h"
+#include "file-item.pb.h"
+
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+namespace ndn {
+namespace chronoshare {
 
 class ActionLog;
-typedef boost::shared_ptr<ActionLog> ActionLogPtr;
-typedef boost::shared_ptr<ActionItem> ActionItemPtr;
+typedef shared_ptr<ActionLog> ActionLogPtr;
+typedef shared_ptr<ActionItem> ActionItemPtr;
 
 class ActionLog : public DbHelper
 {
 public:
-  typedef boost::function<void(std::string /*filename*/, Ccnx::Name /*device_name*/, sqlite3_int64 /*seq_no*/,
-                               HashPtr /*hash*/, time_t /*m_time*/, int /*mode*/, int /*seg_num*/)>
+  class Error : public DbHelper::Error
+  {
+  public:
+    explicit Error(const std::string& what)
+      : DbHelper::Error(what)
+    {
+    }
+  };
+
+public:
+  typedef function<void(std::string /*filename*/, Name /*device_name*/, sqlite3_int64 /*seq_no*/,
+                        ConstBufferPtr /*hash*/, time_t /*m_time*/, int /*mode*/, int /*seg_num*/)>
     OnFileAddedOrChangedCallback;
 
   typedef boost::function<void(std::string /*filename*/)> OnFileRemovedCallback;
 
 public:
-  ActionLog(Ccnx::CcnxWrapperPtr ccnx, const boost::filesystem::path& path, SyncLogPtr syncLog,
+  ActionLog(Face& face, const boost::filesystem::path& path, SyncLogPtr syncLog,
             const std::string& sharedFolder, const std::string& appName,
             OnFileAddedOrChangedCallback onFileAddedOrChanged, OnFileRemovedCallback onFileRemoved);
 
@@ -57,14 +71,11 @@
   // Local operations     //
   //////////////////////////
   ActionItemPtr
-  AddLocalActionUpdate(const std::string& filename,
-                       const Hash& hash,
-                       time_t wtime,
-                       int mode,
+  AddLocalActionUpdate(const std::string& filename, const Buffer& hash, time_t wtime, int mode,
                        int seg_num);
 
   // void
-  // AddActionMove (const std::string &oldFile, const std::string &newFile);
+  // AddActionMove(const std::string &oldFile, const std::string &newFile);
 
   ActionItemPtr
   AddLocalActionDelete(const std::string& filename);
@@ -74,51 +85,52 @@
   //////////////////////////
 
   ActionItemPtr
-  AddRemoteAction(const Ccnx::Name& deviceName, sqlite3_int64 seqno, Ccnx::PcoPtr actionPco);
+  AddRemoteAction(const Name& deviceName, sqlite3_int64 seqno, shared_ptr<Data> actionData);
 
   /**
    * @brief Add remote action using just action's parsed content object
    *
-   * This function extracts device name and sequence number from the content object's and calls the overloaded method
+   * This function extracts device name and sequence number from the content object's and calls the
+   * overloaded method
    */
   ActionItemPtr
-  AddRemoteAction(Ccnx::PcoPtr actionPco);
+  AddRemoteAction(shared_ptr<Data> actionData);
 
   ///////////////////////////
   // General operations    //
   ///////////////////////////
 
-  Ccnx::PcoPtr
-  LookupActionPco(const Ccnx::Name& deviceName, sqlite3_int64 seqno);
+  shared_ptr<Data>
+  LookupActionData(const Name& deviceName, sqlite3_int64 seqno);
 
-  Ccnx::PcoPtr
-  LookupActionPco(const Ccnx::Name& actionName);
+  shared_ptr<Data>
+  LookupActionData(const Name& actionName);
 
   ActionItemPtr
-  LookupAction(const Ccnx::Name& deviceName, sqlite3_int64 seqno);
+  LookupAction(const Name& deviceName, sqlite3_int64 seqno);
 
   ActionItemPtr
-  LookupAction(const Ccnx::Name& actionName);
+  LookupAction(const Name& actionName);
 
   FileItemPtr
-  LookupAction(const std::string& filename, sqlite3_int64 version, const Hash& filehash);
+  LookupAction(const std::string& filename, sqlite3_int64 version, const Buffer& filehash);
 
   /**
-   * @brief Lookup up to [limit] actions starting [offset] in decreasing order (by timestamp) and calling visitor(device_name,seqno,action) for each action
+   * @brief Lookup up to [limit] actions starting [offset] in decreasing order(by timestamp) and
+   * calling visitor(device_name,seqno,action) for each action
    */
   bool
   LookupActionsInFolderRecursively(
-    const boost::function<void(const Ccnx::Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
+    const function<void(const Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
     const std::string& folder, int offset = 0, int limit = -1);
 
   bool
   LookupActionsForFile(
-    const boost::function<void(const Ccnx::Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
+    const function<void(const Name& name, sqlite3_int64 seq_no, const ActionItem&)>& visitor,
     const std::string& file, int offset = 0, int limit = -1);
 
   void
-  LookupRecentFileActions(const boost::function<void(const std::string&, int, int)>& visitor,
-                          int limit = 5);
+  LookupRecentFileActions(const function<void(const std::string&, int, int)>& visitor, int limit = 5);
 
   //
   inline FileStatePtr
@@ -130,7 +142,7 @@
   LogSize();
 
 private:
-  boost::tuple<sqlite3_int64 /*version*/, Ccnx::CcnxCharbufPtr /*device name*/, sqlite3_int64 /*seq_no*/>
+  std::tuple<sqlite3_int64 /*version*/, BufferPtr /*device name*/, sqlite3_int64 /*seq_no*/>
   GetLatestActionForFile(const std::string& filename);
 
   static void
@@ -140,25 +152,22 @@
   SyncLogPtr m_syncLog;
   FileStatePtr m_fileState;
 
-  Ndnx::NdnxWrapperPtr m_ndnx;
+  // Face& m_face;
   std::string m_sharedFolderName;
   std::string m_appName;
 
   OnFileAddedOrChangedCallback m_onFileAddedOrChanged;
   OnFileRemovedCallback m_onFileRemoved;
+  KeyChain m_keyChain;
 };
 
-namespace Error {
-struct ActionLog : virtual boost::exception, virtual std::exception
-{
-};
-}
-
 inline FileStatePtr
 ActionLog::GetFileState()
 {
   return m_fileState;
 }
 
+} // namespace chronoshare
+} // namespace ndn
 
-#endif // ACTION_LOG_H
+#endif // CHRONOSHARE_SRC_ACTION_LOG_HPP
diff --git a/src/file-state.cpp b/src/file-state.cpp
index 33a4384..83d2acc 100644
--- a/src/file-state.cpp
+++ b/src/file-state.cpp
@@ -18,14 +18,13 @@
  * See AUTHORS.md for complete list of ChronoShare authors and contributors.
  */
 
-#include "file-state.h"
-#include "logging.h"
-#include <boost/bind.hpp>
+#include "file-state.hpp"
+#include "core/logging.hpp"
 
 _LOG_INIT(FileState);
 
-using namespace boost;
-using namespace std;
+namespace ndn {
+namespace chronoshare {
 
 const std::string INIT_DATABASE = "\
                                                                         \n\
@@ -63,9 +62,9 @@
 }
 
 void
-FileState::UpdateFile(const std::string& filename, sqlite3_int64 version, const Hash& hash,
-                      const Ccnx::CcnxCharbuf& device_name, sqlite3_int64 seq_no, time_t atime,
-                      time_t mtime, time_t ctime, int mode, int seg_num)
+FileState::UpdateFile(const std::string& filename, sqlite3_int64 version, const Buffer& hash,
+                      const Buffer& device_name, sqlite3_int64 seq_no, time_t atime, time_t mtime,
+                      time_t ctime, int mode, int seg_num)
 {
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_db, "UPDATE FileState "
@@ -81,10 +80,10 @@
                            "WHERE type=0 AND filename=?",
                      -1, &stmt, 0);
 
-  sqlite3_bind_blob(stmt, 1, device_name.buf(), device_name.length(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, device_name.buf(), device_name.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 2, seq_no);
   sqlite3_bind_int64(stmt, 3, version);
-  sqlite3_bind_blob(stmt, 4, hash.GetHash(), hash.GetHashBytes(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 4, hash.buf(), hash.size(), SQLITE_STATIC);
   sqlite3_bind_int64(stmt, 5, atime);
   sqlite3_bind_int64(stmt, 6, mtime);
   sqlite3_bind_int64(stmt, 7, ctime);
@@ -105,7 +104,8 @@
     sqlite3_stmt* stmt;
     sqlite3_prepare_v2(m_db,
                        "INSERT INTO FileState "
-                       "(type,filename,version,device_name,seq_no,file_hash,file_atime,file_mtime,file_ctime,file_chmod,file_seg_num) "
+                       "(type,filename,version,device_name,seq_no,file_hash,"
+                       "file_atime,file_mtime,file_ctime,file_chmod,file_seg_num) "
                        "VALUES (0, ?, ?, ?, ?, ?, "
                        "datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), datetime(?, 'unixepoch'), ?, ?)",
                        -1, &stmt, 0);
@@ -114,9 +114,9 @@
 
     sqlite3_bind_text(stmt, 1, filename.c_str(), -1, SQLITE_STATIC);
     sqlite3_bind_int64(stmt, 2, version);
-    sqlite3_bind_blob(stmt, 3, device_name.buf(), device_name.length(), SQLITE_STATIC);
+    sqlite3_bind_blob(stmt, 3, device_name.buf(), device_name.size(), SQLITE_STATIC);
     sqlite3_bind_int64(stmt, 4, seq_no);
-    sqlite3_bind_blob(stmt, 5, hash.GetHash(), hash.GetHashBytes(), SQLITE_STATIC);
+    sqlite3_bind_blob(stmt, 5, hash.buf(), hash.size(), SQLITE_STATIC);
     sqlite3_bind_int64(stmt, 6, atime);
     sqlite3_bind_int64(stmt, 7, mtime);
     sqlite3_bind_int64(stmt, 8, ctime);
@@ -139,7 +139,6 @@
   }
 }
 
-
 void
 FileState::DeleteFile(const std::string& filename)
 {
@@ -154,7 +153,6 @@
   sqlite3_finalize(stmt);
 }
 
-
 void
 FileState::SetFileComplete(const std::string& filename)
 {
@@ -170,7 +168,6 @@
   sqlite3_finalize(stmt);
 }
 
-
 /**
  * @todo Implement checking modification time and permissions
  */
@@ -207,7 +204,7 @@
 }
 
 FileItemsPtr
-FileState::LookupFilesForHash(const Hash& hash)
+FileState::LookupFilesForHash(const Buffer& hash)
 {
   sqlite3_stmt* stmt;
   sqlite3_prepare_v2(m_db,
@@ -216,7 +213,7 @@
                      "   WHERE type = 0 AND file_hash = ?",
                      -1, &stmt, 0);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
-  sqlite3_bind_blob(stmt, 1, hash.GetHash(), hash.GetHashBytes(), SQLITE_STATIC);
+  sqlite3_bind_blob(stmt, 1, hash.buf(), hash.size(), SQLITE_STATIC);
   _LOG_DEBUG_COND(sqlite3_errcode(m_db) != SQLITE_OK, sqlite3_errmsg(m_db));
 
   FileItemsPtr retval = make_shared<FileItems>();
@@ -243,7 +240,7 @@
 }
 
 void
-FileState::LookupFilesInFolder(const boost::function<void(const FileItem&)>& visitor,
+FileState::LookupFilesInFolder(const function<void(const FileItem&)>& visitor,
                                const std::string& folder, int offset /*=0*/, int limit /*=-1*/)
 {
   sqlite3_stmt* stmt;
@@ -286,13 +283,15 @@
 FileState::LookupFilesInFolder(const std::string& folder, int offset /*=0*/, int limit /*=-1*/)
 {
   FileItemsPtr retval = make_shared<FileItems>();
-  LookupFilesInFolder(boost::bind(&FileItems::push_back, retval.get(), _1), folder, offset, limit);
+  LookupFilesInFolder(bind(static_cast<void (FileItems::*)(const FileItem&)>(&FileItems::push_back),
+                           retval.get(), _1),
+                      folder, offset, limit);
 
   return retval;
 }
 
 bool
-FileState::LookupFilesInFolderRecursively(const boost::function<void(const FileItem&)>& visitor,
+FileState::LookupFilesInFolderRecursively(const function<void(const FileItem&)>& visitor,
                                           const std::string& folder, int offset /*=0*/,
                                           int limit /*=-1*/)
 {
@@ -308,7 +307,7 @@
     sqlite3_prepare_v2(m_db,
                        "SELECT filename,version,device_name,seq_no,file_hash,strftime('%s', file_mtime),file_chmod,file_seg_num,is_complete "
                        "   FROM FileState "
-                       "   WHERE type = 0 AND is_dir_prefix (?, directory)=1 "
+                       "   WHERE type = 0 AND is_dir_prefix(?, directory)=1 "
                        "   ORDER BY filename "
                        "   LIMIT ? OFFSET ?",
                        -1, &stmt,
@@ -367,7 +366,12 @@
                                           int limit /*=-1*/)
 {
   FileItemsPtr retval = make_shared<FileItems>();
-  LookupFilesInFolder(boost::bind(&FileItems::push_back, retval.get(), _1), folder, offset, limit);
+  LookupFilesInFolder(bind(static_cast<void (FileItems::*)(const FileItem&)>(&FileItems::push_back),
+                           retval.get(), _1),
+                      folder, offset, limit);
 
   return retval;
 }
+
+} // namespace chronoshare
+} // namespace ndn
diff --git a/src/file-state.hpp b/src/file-state.hpp
index e074794..d9ea339 100644
--- a/src/file-state.hpp
+++ b/src/file-state.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
  *
  * This file is part of ChronoShare, a decentralized file sharing application over NDN.
  *
@@ -22,20 +22,20 @@
 #define FILE_STATE_H
 
 #include "db-helper.hpp"
+#include "core/chronoshare-common.hpp"
 
-#include "ccnx-name.hpp"
-#include "file-item.pb.hpp"
-#include "hash-helper.hpp"
+#include "file-item.pb.h"
 
-#include <boost/exception/all.hpp>
-#include <boost/tuple/tuple.hpp>
+#include <ndn-cxx/util/digest.hpp>
 
 #include <list>
 
-typedef std::list<FileItem> FileItems;
-typedef boost::shared_ptr<FileItem> FileItemPtr;
-typedef boost::shared_ptr<FileItems> FileItemsPtr;
+namespace ndn {
+namespace chronoshare {
 
+typedef std::list<FileItem> FileItems;
+typedef shared_ptr<FileItem> FileItemPtr;
+typedef shared_ptr<FileItems> FileItemsPtr;
 
 class FileState : public DbHelper
 {
@@ -47,8 +47,8 @@
    * @brief Update or add a file
    */
   void
-  UpdateFile(const std::string& filename, sqlite3_int64 version, const Hash& hash,
-             const Ccnx::CcnxCharbuf& device_name, sqlite3_int64 seqno, time_t atime, time_t mtime,
+  UpdateFile(const std::string& filename, sqlite3_int64 version, const Buffer& hash,
+             const Buffer& device_name, sqlite3_int64 seqno, time_t atime, time_t mtime,
              time_t ctime, int mode, int seg_num);
 
   /**
@@ -60,7 +60,8 @@
   /**
    * @brief Set "complete" flag
    *
-   * The call will do nothing if FileState does not have a record for the file (e.g., file got subsequently deleted)
+   * The call will do nothing if FileState does not have a record for the file(e.g., file got
+   * subsequently deleted)
    */
   void
   SetFileComplete(const std::string& filename);
@@ -72,45 +73,49 @@
   LookupFile(const std::string& filename);
 
   /**
-   * @brief Lookup file state using content hash (multiple items may be returned)
+   * @brief Lookup file state using content hash(multiple items may be returned)
    */
   FileItemsPtr
-  LookupFilesForHash(const Hash& hash);
+  LookupFilesForHash(const Buffer& hash);
 
   /**
    * @brief Lookup all files in the specified folder and call visitor(file) for each file
    */
   void
-  LookupFilesInFolder(const boost::function<void(const FileItem&)>& visitor,
-                      const std::string& folder, int offset = 0, int limit = -1);
+  LookupFilesInFolder(const function<void(const FileItem&)>& visitor, const std::string& folder,
+                      int offset = 0, int limit = -1);
 
   /**
-   * @brief Lookup all files in the specified folder (wrapper around the overloaded version)
+   * @brief Lookup all files in the specified folder(wrapper around the overloaded version)
    */
   FileItemsPtr
   LookupFilesInFolder(const std::string& folder, int offset = 0, int limit = -1);
 
   /**
-   * @brief Recursively lookup all files in the specified folder and call visitor(file) for each file
+   * @brief Recursively lookup all files in the specified folder and call visitor(file) for each
+   * file
    */
   bool
-  LookupFilesInFolderRecursively(const boost::function<void(const FileItem&)>& visitor,
+  LookupFilesInFolderRecursively(const function<void(const FileItem&)>& visitor,
                                  const std::string& folder, int offset = 0, int limit = -1);
 
   /**
-   * @brief Recursively lookup all files in the specified folder (wrapper around the overloaded version)
+   * @brief Recursively lookup all files in the specified folder(wrapper around the overloaded
+   * version)
    */
   FileItemsPtr
   LookupFilesInFolderRecursively(const std::string& folder, int offset = 0, int limit = -1);
 };
 
-typedef boost::shared_ptr<FileState> FileStatePtr;
+typedef shared_ptr<FileState> FileStatePtr;
 
-namespace Error {
+namespace error {
 struct FileState : virtual boost::exception, virtual std::exception
 {
 };
-}
+} // namespace error
 
+} // namespace chronoshare
+} // namespace ndn
 
 #endif // ACTION_LOG_H
