diff --git a/src/logic.cpp b/src/logic.cpp
index d3e5f11..44115eb 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -38,7 +38,6 @@
 
 namespace chronosync {
 
-using ndn::ConstBufferPtr;
 using ndn::EventId;
 
 const uint8_t EMPTY_DIGEST_VALUE[] = {
@@ -49,12 +48,12 @@
 };
 
 #ifdef _DEBUG
-int Logic::m_instanceCounter = 0;
+int Logic::s_instanceCounter = 0;
 #endif
 
 const ndn::Name Logic::DEFAULT_NAME;
 const ndn::Name Logic::EMPTY_NAME;
-const std::shared_ptr<ndn::Validator> Logic::DEFAULT_VALIDATOR;
+const std::shared_ptr<Validator> Logic::DEFAULT_VALIDATOR;
 const time::steady_clock::Duration Logic::DEFAULT_RESET_TIMER = time::seconds(0);
 const time::steady_clock::Duration Logic::DEFAULT_CANCEL_RESET_TIMER = time::milliseconds(500);
 const time::milliseconds Logic::DEFAULT_RESET_INTEREST_LIFETIME(1000);
@@ -62,7 +61,7 @@
 const time::milliseconds Logic::DEFAULT_SYNC_REPLY_FRESHNESS(1000);
 const time::milliseconds Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME(1000);
 
-const ndn::ConstBufferPtr Logic::EMPTY_DIGEST(new ndn::Buffer(EMPTY_DIGEST_VALUE, 32));
+const ConstBufferPtr Logic::EMPTY_DIGEST(new ndn::Buffer(EMPTY_DIGEST_VALUE, 32));
 const ndn::name::Component Logic::RESET_COMPONENT("reset");
 const ndn::name::Component Logic::RECOVERY_COMPONENT("recovery");
 
@@ -71,7 +70,7 @@
              const Name& defaultUserPrefix,
              const UpdateCallback& onUpdate,
              const Name& defaultSigningId,
-             std::shared_ptr<ndn::Validator> validator,
+             std::shared_ptr<Validator> validator,
              const time::steady_clock::Duration& resetTimer,
              const time::steady_clock::Duration& cancelResetTimer,
              const time::milliseconds& resetInterestLifetime,
@@ -99,7 +98,7 @@
   , m_validator(validator)
 {
 #ifdef _DEBUG
-  m_instanceId = m_instanceCounter++;
+  m_instanceId = s_instanceCounter++;
 #endif
 
   _LOG_DEBUG_ID(">> Logic::Logic");
@@ -251,7 +250,7 @@
 
     if (!m_isInReset) {
       _LOG_DEBUG_ID("updateSeqNo: not in Reset ");
-      ndn::ConstBufferPtr previousRoot = m_state.getRootDigest();
+      ConstBufferPtr previousRoot = m_state.getRootDigest();
       {
         std::string hash = ndn::toHex(previousRoot->buf(), previousRoot->size(), false);
         _LOG_DEBUG_ID("Hash: " << hash);
@@ -260,8 +259,7 @@
       bool isInserted = false;
       bool isUpdated = false;
       SeqNo oldSeq;
-      boost::tie(isInserted, isUpdated, oldSeq) = m_state.update(node.sessionName,
-                                                                 node.seqNo);
+      std::tie(isInserted, isUpdated, oldSeq) = m_state.update(node.sessionName, node.seqNo);
 
       _LOG_DEBUG_ID("Insert: " << std::boolalpha << isInserted);
       _LOG_DEBUG_ID("Updated: " << std::boolalpha << isUpdated);
@@ -322,7 +320,7 @@
   }
   // Do not process exclude interests, they should be answered by CS
   else if (interest.getExclude().empty()) {
-    processSyncInterest(interest.shared_from_this());
+    processSyncInterest(interest);
   }
 
   _LOG_DEBUG_ID("<< Logic::onSyncInterest");
@@ -344,15 +342,15 @@
   //                         bind(&Logic::onSyncDataValidated, this, _1),
   //                         bind(&Logic::onSyncDataValidationFailed, this, _1));
   // else
-  //   onSyncDataValidated(data.shared_from_this());
+  //   onSyncDataValidated(data);
 
   if (interest.getExclude().empty()) {
     _LOG_DEBUG_ID("First data");
-    onSyncDataValidated(data.shared_from_this());
+    onSyncDataValidated(data);
   }
   else {
     _LOG_DEBUG_ID("Data obtained using exclude filter");
-    onSyncDataValidated(data.shared_from_this(), false);
+    onSyncDataValidated(data, false);
   }
   sendExcludeInterest(interest, data);
 
@@ -375,29 +373,27 @@
 }
 
 void
-Logic::onSyncDataValidationFailed(const shared_ptr<const Data>& data)
+Logic::onSyncDataValidationFailed(const Data& data)
 {
   // SyncReply cannot be validated.
 }
 
 void
-Logic::onSyncDataValidated(const shared_ptr<const Data>& data, bool firstData)
+Logic::onSyncDataValidated(const Data& data, bool firstData)
 {
-  Name name = data->getName();
+  Name name = data.getName();
   ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
 
-  processSyncData(name, digest, data->getContent().blockFromValue(), firstData);
+  processSyncData(name, digest, data.getContent().blockFromValue(), firstData);
 }
 
 void
-Logic::processSyncInterest(const shared_ptr<const Interest>& interest,
-                           bool isTimedProcessing/*=false*/)
+Logic::processSyncInterest(const Interest& interest, bool isTimedProcessing/*=false*/)
 {
   _LOG_DEBUG_ID(">> Logic::processSyncInterest");
 
-  const Name& name = interest->getName();
-  ConstBufferPtr digest =
-      make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
+  Name name = interest.getName();
+  ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
 
   ConstBufferPtr rootDigest = m_state.getRootDigest();
 
@@ -480,13 +476,13 @@
 
 void
 Logic::processSyncData(const Name& name,
-                       ndn::ConstBufferPtr digest,
+                       ConstBufferPtr digest,
                        const Block& syncReplyBlock,
                        bool firstData)
 {
   _LOG_DEBUG_ID(">> Logic::processSyncData");
   DiffStatePtr commit = make_shared<DiffState>();
-  ndn::ConstBufferPtr previousRoot = m_state.getRootDigest();
+  ConstBufferPtr previousRoot = m_state.getRootDigest();
 
   try {
     m_interestTable.erase(digest); // Remove satisfied interest from PIT
@@ -505,7 +501,7 @@
         bool isInserted = false;
         bool isUpdated = false;
         SeqNo oldSeq;
-        boost::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq);
+        std::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq);
         if (isInserted || isUpdated) {
           commit->update(info, seq);
 
@@ -550,13 +546,14 @@
   _LOG_DEBUG_ID(">> Logic::satisfyPendingSyncInterests");
   try {
     _LOG_DEBUG_ID("InterestTable size: " << m_interestTable.size());
-    for (InterestTable::const_iterator it = m_interestTable.begin();
-         it != m_interestTable.end(); it++) {
+    auto it = m_interestTable.begin();
+    while (it != m_interestTable.end()) {
       ConstUnsatisfiedInterestPtr request = *it;
+      ++it;
       if (request->isUnknown)
-        sendSyncData(updatedPrefix, request->interest->getName(), m_state);
+        sendSyncData(updatedPrefix, request->interest.getName(), m_state);
       else
-        sendSyncData(updatedPrefix, request->interest->getName(), *commit);
+        sendSyncData(updatedPrefix, request->interest.getName(), *commit);
     }
     m_interestTable.clear();
   }
@@ -567,7 +564,7 @@
 }
 
 void
-Logic::insertToDiffLog(DiffStatePtr commit, ndn::ConstBufferPtr previousRoot)
+Logic::insertToDiffLog(DiffStatePtr commit, ConstBufferPtr previousRoot)
 {
   _LOG_DEBUG_ID(">> Logic::insertToDiffLog");
   // Connect to the history
@@ -646,17 +643,17 @@
 Logic::sendSyncData(const Name& nodePrefix, const Name& name, const State& state)
 {
   _LOG_DEBUG_ID(">> Logic::sendSyncData");
-  shared_ptr<Data> syncReply = make_shared<Data>(name);
-  syncReply->setContent(state.wireEncode());
-  syncReply->setFreshnessPeriod(m_syncReplyFreshness);
+  Data syncReply(name);
+  syncReply.setContent(state.wireEncode());
+  syncReply.setFreshnessPeriod(m_syncReplyFreshness);
   if (m_nodeList.find(nodePrefix) == m_nodeList.end())
     return;
   if (m_nodeList[nodePrefix].signingId.empty())
-    m_keyChain.sign(*syncReply);
+    m_keyChain.sign(syncReply);
   else
-    m_keyChain.sign(*syncReply, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
+    m_keyChain.sign(syncReply, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
 
-  m_face.put(*syncReply);
+  m_face.put(syncReply);
 
   // checking if our own interest got satisfied
   if (m_outstandingInterestName == name) {
@@ -692,14 +689,14 @@
 }
 
 void
-Logic::printDigest(ndn::ConstBufferPtr digest)
+Logic::printDigest(ConstBufferPtr digest)
 {
   std::string hash = ndn::toHex(digest->buf(), digest->size(), false);
   _LOG_DEBUG_ID("Hash: " << hash);
 }
 
 void
-Logic::sendRecoveryInterest(ndn::ConstBufferPtr digest)
+Logic::sendRecoveryInterest(ConstBufferPtr digest)
 {
   _LOG_DEBUG_ID(">> Logic::sendRecoveryInterest");
 
@@ -726,7 +723,7 @@
 {
   _LOG_DEBUG_ID(">> Logic::processRecoveryInterest");
 
-  const Name& name = interest.getName();
+  Name name = interest.getName();
   ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
 
   ConstBufferPtr rootDigest = m_state.getRootDigest();
@@ -745,7 +742,7 @@
 Logic::onRecoveryData(const Interest& interest, const Data& data)
 {
   _LOG_DEBUG_ID(">> Logic::onRecoveryData");
-  onSyncDataValidated(data.shared_from_this());
+  onSyncDataValidated(data);
   _LOG_DEBUG_ID("<< Logic::onRecoveryData");
 }
 
@@ -785,7 +782,7 @@
 }
 
 void
-Logic::formAndSendExcludeInterest(const Name& nodePrefix, const State& commit, ndn::ConstBufferPtr previousRoot)
+Logic::formAndSendExcludeInterest(const Name& nodePrefix, const State& commit, ConstBufferPtr previousRoot)
 {
   _LOG_DEBUG_ID(">> Logic::formAndSendExcludeInterest");
   Name interestName;
@@ -793,17 +790,17 @@
               .append(ndn::name::Component(*previousRoot));
   Interest interest(interestName);
 
-  shared_ptr<Data> data = make_shared<Data>(interestName);
-  data->setContent(commit.wireEncode());
-  data->setFreshnessPeriod(m_syncReplyFreshness);
+  Data data(interestName);
+  data.setContent(commit.wireEncode());
+  data.setFreshnessPeriod(m_syncReplyFreshness);
   if (m_nodeList.find(nodePrefix) == m_nodeList.end())
     return;
   if (m_nodeList[nodePrefix].signingId.empty())
-    m_keyChain.sign(*data);
+    m_keyChain.sign(data);
   else
-    m_keyChain.sign(*data, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
+    m_keyChain.sign(data, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
 
-  sendExcludeInterest(interest, *data);
+  sendExcludeInterest(interest, data);
 
   _LOG_DEBUG_ID("<< Logic::formAndSendExcludeInterest");
 }
