diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 617830b..56692e5 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -31,7 +31,6 @@
 #include <boost/lexical_cast.hpp>
 #include <vector>
 
-using namespace std;
 using namespace ndn;
 
 INIT_LOGGER ("SyncLogic");
@@ -89,7 +88,7 @@
   m_reexpressingInterestId = m_scheduler.scheduleEvent (time::seconds (0), // no need to add jitter
                                                         bind (&SyncLogic::sendSyncInterest, this));
 
-  m_instanceId = string("Instance " + boost::lexical_cast<string>(m_instanceCounter++) + " ");
+  m_instanceId = std::string("Instance " + boost::lexical_cast<std::string>(m_instanceCounter++) + " ");
 }
 
 SyncLogic::SyncLogic (const Name& syncPrefix,
@@ -141,8 +140,8 @@
   BOOST_ASSERT (nameLengthDiff > 0);
   BOOST_ASSERT (nameLengthDiff < 3);
   
-  string hash = name.get(-1).toEscapedString();
-  string interestType;
+  std::string hash = name.get(-1).toEscapedString();
+  std::string interestType;
   
   if(nameLengthDiff == 1)
     interestType = "normal";
@@ -152,7 +151,7 @@
   _LOG_DEBUG_ID (hash << ", " << interestType);
 
   DigestPtr digest = boost::make_shared<Digest> ();
-  istringstream is (hash);
+  std::istringstream is (hash);
   is >> *digest;
 
   return make_tuple (digest, interestType);
@@ -174,7 +173,7 @@
         return;
 
       DigestConstPtr digest;
-      string type;
+      std::string type;
       tie (digest, type) = convertNameToDigestAndType (name);
 
       if (type == "normal") // kind of ineffective...
@@ -195,7 +194,7 @@
 }
 
 void
-SyncLogic::onSyncRegisterFailed(const Name& prefix, const string& msg)
+SyncLogic::onSyncRegisterFailed(const Name& prefix, const std::string& msg)
 {
   _LOG_DEBUG_ID("Sync prefix registration failed! " << msg);
 }
@@ -232,7 +231,7 @@
       _LOG_DEBUG_ID ("<< D " << name);
   
       DigestConstPtr digest;
-      string type;
+      std::string type;
       tie (digest, type) = convertNameToDigestAndType (name);
 
       if (type == "normal")
@@ -338,7 +337,7 @@
       }
       msg >> diff;
 
-      vector<MissingDataInfo> v;
+      std::vector<MissingDataInfo> v;
       BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
         {
           DiffLeafConstPtr diffLeaf = boost::dynamic_pointer_cast<const DiffLeaf> (leaf);
@@ -372,15 +371,15 @@
                   {
                     MissingDataInfo mdi = {info->toString(), oldSeq, seq};
                     {
-                      ostringstream interestName;
+                      std::ostringstream interestName;
                       interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
                       _LOG_DEBUG_ID("+++++++++++++++ " + interestName.str());
                     }
                     if (m_perBranch)
                     {
-                       ostringstream interestName;
-                       interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
-                       m_onUpdateBranch(interestName.str());
+                      std::ostringstream interestName;
+                      interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
+                      m_onUpdateBranch(interestName.str());
                     }
                     else
                     {
@@ -575,7 +574,7 @@
 
   {
     m_outstandingInterestName = m_syncPrefix;
-    ostringstream os;
+    std::ostringstream os;
     os << *m_state->getDigest();
     m_outstandingInterestName.append(os.str());
     _LOG_DEBUG_ID (">> I " << m_outstandingInterestName);
@@ -599,7 +598,7 @@
 void
 SyncLogic::sendSyncRecoveryInterests (DigestConstPtr digest)
 {
-  ostringstream os;
+  std::ostringstream os;
   os << *digest;
   
   Name interestName = m_syncPrefix;
@@ -670,10 +669,10 @@
     }
 }
 
-string
+std::string
 SyncLogic::getRootDigest() 
 {
-  ostringstream os;
+  std::ostringstream os;
   os << *m_state->getDigest();
   return os.str();
 }
@@ -704,7 +703,7 @@
       // do not return forwarder prefix
       if (prefix != forwarderPrefix)
       {
-        m.insert(pair<std::string, bool>(prefix, false));
+        m.insert(std::pair<std::string, bool>(prefix, false));
       }
     }
 
