diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 240e9df..67fb342 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -18,6 +18,7 @@
  * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
  *         Chaoyi Bian <bcy@pku.edu.cn>
  *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Yingdi Yu <yingdi@cs.ucla.edu>
  */
 
 #ifdef NS3_MODULE
@@ -179,21 +180,21 @@
  * Recovery name:  .../recovery/<hash>
  */
 boost::tuple<DigestConstPtr, std::string>
-SyncLogic::convertNameToDigestAndType (const std::string &name)
+SyncLogic::convertNameToDigestAndType (const Name &name)
 {
-  BOOST_ASSERT (name.find (m_syncPrefix.toUri()) == 0);
+  BOOST_ASSERT (m_syncPrefix.isPrefixOf(name));
 
-  string hash = name.substr (m_syncPrefix.toUri().size (), name.size ()-m_syncPrefix.toUri().size ());
-  if (hash[0] == '/')
-    hash = hash.substr (1, hash.size ()-1);
-  string interestType = "normal";
-
-  size_t pos = hash.find ('/');
-  if (pos != string::npos)
-    {
-      interestType = hash.substr (0, pos);
-      hash         = hash.substr (pos + 1);
-    }
+  int nameLengthDiff = name.size() - m_syncPrefix.size();
+  BOOST_ASSERT (nameLengthDiff > 0);
+  BOOST_ASSERT (nameLengthDiff < 3);
+  
+  string hash = name.get(-1).toEscapedString();
+  string interestType;
+  
+  if(nameLengthDiff == 1)
+    interestType = "normal";
+  else
+    interestType = name.get(-2).toEscapedString();
 
   _LOG_TRACE (hash << ", " << interestType);
 
@@ -210,8 +211,10 @@
                            Transport& transport, 
                            uint64_t registeredPrefixId)
 {
-  _LOG_DEBUG("respondSyncInterest: " << interest->getName().toUri());
-  string name = interest->getName().toUri();
+  Name name = interest->getName();
+
+  _LOG_DEBUG("respondSyncInterest: " << name);
+
   try
     {
       _LOG_TRACE ("<< I " << name);
@@ -287,7 +290,7 @@
 void
 SyncLogic::onSyncDataVerified(const shared_ptr<Data>& data)
 {
-  string name = data->getName().toUri();
+  Name name = data->getName();
   const char* wireData = (const char*)data->getContent().value();
   size_t len = data->getContent().value_size();
 
@@ -319,7 +322,7 @@
 }
 
 void
-SyncLogic::processSyncInterest (const std::string &name, DigestConstPtr digest, bool timedProcessing/*=false*/)
+SyncLogic::processSyncInterest (const Name &name, DigestConstPtr digest, bool timedProcessing/*=false*/)
 {
   _LOG_DEBUG("processSyncInterest");
   DigestConstPtr rootDigest;
@@ -344,7 +347,7 @@
   if (*rootDigest == *digest)
     {
       _LOG_TRACE ("processSyncInterest (): Same state. Adding to PIT");
-      m_syncInterestTable.insert (digest, name, false);
+      m_syncInterestTable.insert (digest, name.toUri(), false);
       return;
     }
   
@@ -360,7 +363,7 @@
 
   if (!timedProcessing)
     {
-      bool exists = m_syncInterestTable.insert (digest, name, true);
+      bool exists = m_syncInterestTable.insert (digest, name.toUri(), true);
       if (exists) // somebody else replied, so restart random-game timer
         {
           _LOG_DEBUG ("Unknown digest, but somebody may have already replied, so restart our timer");
@@ -384,7 +387,7 @@
 }
 
 void
-SyncLogic::processSyncData (const std::string &name, DigestConstPtr digest, const char *wireData, size_t len)
+SyncLogic::processSyncData (const Name &name, DigestConstPtr digest, const char *wireData, size_t len)
 {
   DiffStatePtr diffLog = boost::make_shared<DiffState> ();
   bool ownInterestSatisfied = false;
@@ -392,7 +395,7 @@
   try
     {
 
-      m_syncInterestTable.remove (name); // Remove satisfied interest from PIT
+      m_syncInterestTable.remove (name.toUri()); // Remove satisfied interest from PIT
 
       ownInterestSatisfied = (name == m_outstandingInterestName);
 
@@ -504,7 +507,7 @@
 }
 
 void
-SyncLogic::processSyncRecoveryInterest (const std::string &name, DigestConstPtr digest)
+SyncLogic::processSyncRecoveryInterest (const Name &name, DigestConstPtr digest)
 {
   _LOG_DEBUG("processSyncRecoveryInterest");
   DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);
@@ -577,13 +580,13 @@
 }
 
 void
-SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
+SyncLogic::addLocalNames (const Name &prefix, uint32_t session, uint32_t seq)
 {
   DiffStatePtr diff;
   {
     //cout << "Add local names" <<endl;
     boost::recursive_mutex::scoped_lock lock (m_stateMutex);
-    NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+    NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix.toUri());
 
     _LOG_DEBUG ("addLocalNames (): old state " << *m_state->getDigest ());
 
@@ -602,12 +605,12 @@
 }
 
 void
-SyncLogic::remove(const string &prefix) 
+SyncLogic::remove(const Name &prefix) 
 {
   DiffStatePtr diff;
   {
     boost::recursive_mutex::scoped_lock lock (m_stateMutex);
-    NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+    NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix.toUri());
     m_state->remove(info);	
 
     // increment the sequence number for the forwarder node
@@ -636,39 +639,41 @@
 SyncLogic::sendSyncInterest ()
 {
   _LOG_DEBUG("sendSyncInterest");
-  ostringstream os;
 
   {
     boost::recursive_mutex::scoped_lock lock (m_stateMutex);
-
-    os << m_syncPrefix << "/" << *m_state->getDigest();
-    m_outstandingInterestName = os.str ();
-    _LOG_TRACE (">> I " << os.str ());
+    m_outstandingInterestName = m_syncPrefix;
+    ostringstream os;
+    os << *m_state->getDigest();
+    m_outstandingInterestName.append(os.str());
+    _LOG_TRACE (">> I " << m_outstandingInterestName);
   }
 
-  _LOG_DEBUG("sendSyncInterest: " << os.str());
+  _LOG_DEBUG("sendSyncInterest: " << m_outstandingInterestName);
 
   m_scheduler.cancel (REEXPRESSING_INTEREST);
   m_scheduler.schedule (TIME_SECONDS_WITH_JITTER (m_syncInterestReexpress),
                         func_lib::bind (&SyncLogic::sendSyncInterest, this),
                         REEXPRESSING_INTEREST);
 
-  shared_ptr<ndn::Interest> interest = make_shared<ndn::Interest>(os.str());
+  ndn::Interest interest(m_outstandingInterestName);
 
   OnVerified onVerified = func_lib::bind(&SyncLogic::onSyncDataVerified, this, _1);
   OnVerifyFailed onVerifyFailed = func_lib::bind(&SyncLogic::onSyncDataVerifyFailed, this, _1);
 
-  m_face->expressInterest(*interest,
+  m_face->expressInterest(interest,
                           func_lib::bind(&SyncLogic::onSyncData, this, _1, _2, onVerified, onVerifyFailed),
-                          func_lib::bind(&SyncLogic::onSyncDataTimeout, this, _1, 1, onVerified, onVerifyFailed));
+                          func_lib::bind(&SyncLogic::onSyncDataTimeout, this, _1, 0, onVerified, onVerifyFailed));
 }
 
 void
 SyncLogic::sendSyncRecoveryInterests (DigestConstPtr digest)
 {
   ostringstream os;
-  os << m_syncPrefix << "/recovery/" << *digest;
-  _LOG_TRACE (">> I " << os.str ());
+  os << *digest;
+  
+  Name interestName = m_syncPrefix;
+  interestName.append("recovery").append(os.str());
 
   TimeDuration nextRetransmission = TIME_MILLISECONDS_WITH_JITTER (m_recoveryRetransmissionInterval);
   m_recoveryRetransmissionInterval <<= 1;
@@ -681,19 +686,19 @@
                             REEXPRESSING_RECOVERY_INTEREST);
     }
 
-  shared_ptr<ndn::Interest> interest = make_shared<ndn::Interest>(os.str());
+  ndn::Interest interest(interestName);
 
   OnVerified onVerified = func_lib::bind(&SyncLogic::onSyncDataVerified, this, _1);
   OnVerifyFailed onVerifyFailed = func_lib::bind(&SyncLogic::onSyncDataVerifyFailed, this, _1);
 
-  m_face->expressInterest(*interest,
+  m_face->expressInterest(interest,
                           func_lib::bind(&SyncLogic::onSyncData, this, _1, _2, onVerified, onVerifyFailed),
-                          func_lib::bind(&SyncLogic::onSyncDataTimeout, this, _1, 1, onVerified, onVerifyFailed));
+                          func_lib::bind(&SyncLogic::onSyncDataTimeout, this, _1, 0, onVerified, onVerifyFailed));
 }
 
 
 void
-SyncLogic::sendSyncData (const std::string &name, DigestConstPtr digest, StateConstPtr state)
+SyncLogic::sendSyncData (const Name &name, DigestConstPtr digest, StateConstPtr state)
 {
   SyncStateMsg msg;
   msg << (*state);
@@ -703,21 +708,19 @@
 // pass in state msg instead of state, so that there is no need to lock the state until
 // this function returns
 void
-SyncLogic::sendSyncData (const std::string &name, DigestConstPtr digest, SyncStateMsg &ssm)
+SyncLogic::sendSyncData (const Name &name, DigestConstPtr digest, SyncStateMsg &ssm)
 {
   _LOG_TRACE (">> D " << name);
   int size = ssm.ByteSize();
   char *wireData = new char[size];
-  Name dataName(name);
-  Name signingIdentity = m_policy->inferSigningIdentity(dataName);
+  Name signingIdentity = m_policy->inferSigningIdentity(name);
 
-  shared_ptr<Data> syncData = make_shared<Data>(dataName);
-  syncData->setContent(reinterpret_cast<const uint8_t*>(wireData), size);
+  Data syncData(name);
+  syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
   
-  Name certificateName = m_keyChain->getDefaultCertificateNameForIdentity(signingIdentity);
-  m_keyChain->sign(*syncData, certificateName);
+  m_keyChain->signByIdentity(syncData, signingIdentity);
   
-  m_face->put(*syncData);
+  m_face->put(syncData);
   
   delete []wireData;
 
