diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index f9f8537..c4a8487 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -181,17 +181,17 @@
     {
       recursive_mutex::scoped_lock lock (m_stateMutex);
       
-  string last = name.substr(name.find_last_of("/") + 1);
-  istringstream ss (dataBuffer);
+      string last = name.substr(name.find_last_of("/") + 1);
+      istringstream ss (dataBuffer);
 
-  if (last == "state")
-  {
-    FullState full;
-    ss >> full;
+      if (last == "state")
+        {
+          FullState full;
+          ss >> full;
           BOOST_FOREACH (LeafConstPtr leaf, full.getLeaves()) // order doesn't matter
-    {
-      NameInfoConstPtr info = leaf->getInfo ();
-      SeqNo seq = leaf->getSeq ();
+            {
+              NameInfoConstPtr info = leaf->getInfo ();
+              SeqNo seq = leaf->getSeq ();
 
               bool inserted = false;
               bool updated = false;
@@ -202,22 +202,22 @@
                 {
                   diffLog->update (info, seq);
                   m_onUpdate (info->toString (), seq.getSeq(), oldSeq);
-    }
-  }
+                }
+            }
         }
-  else
-  {
-    DiffState diff;
-    ss >> diff;
-    BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
-    {
+      else
+        {
+          DiffState diff;
+          ss >> diff;
+          BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
+            {
               DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
               BOOST_ASSERT (diffLeaf != 0);
 
-      NameInfoConstPtr info = diffLeaf->getInfo();
+              NameInfoConstPtr info = diffLeaf->getInfo();
               if (diffLeaf->getOperation() == UPDATE)
                 {
-      SeqNo seq = diffLeaf->getSeq();
+                  SeqNo seq = diffLeaf->getSeq();
 
                   bool inserted = false;
                   bool updated = false;
@@ -228,8 +228,8 @@
                     {
                       diffLog->update (info, seq);
                       m_onUpdate (info->toString (), seq.getSeq(), oldSeq);
-    }
-  }
+                    }
+                }
               else if (diffLeaf->getOperation() == REMOVE)
                 {
                   if (m_state.remove (info))
@@ -245,8 +245,8 @@
             }
         }
 
-  diffLog->setDigest(m_state.getDigest());
-  m_log.insert (diffLog);
+      diffLog->setDigest(m_state.getDigest());
+      m_log.insert (diffLog);
     }
   catch (Error::SyncXmlDecodingFailure &e)
     {
@@ -256,31 +256,17 @@
 
   if (diffLog->getLeaves ().size () > 0)
     {
-  // notify upper layer
-  BOOST_FOREACH (LeafConstPtr leaf, diffLog->getLeaves ())
-    {
+      // notify upper layer
+      BOOST_FOREACH (LeafConstPtr leaf, diffLog->getLeaves ())
+        {
           DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
           BOOST_ASSERT (diffLeaf != 0);
           
-            // m_fetchCallback (prefix, 1, seq.getSeq());
-    }
+          // m_fetchCallback (prefix, 1, seq.getSeq());
+        }
   
-  sendSyncInterest();
-}
-}
-
-void
-SyncLogic::processPendingSyncInterests(DiffStatePtr &diff) {
-  diff->setDigest(m_state.getDigest());
-	m_log.insert(diff);
-
-  vector<string> pis = m_syncInterestTable.fetchAll ();
-  stringstream ss;
-  ss << *diff;
-  for (vector<string>::iterator ii = pis.begin(); ii != pis.end(); ++ii)
-  {
-    m_ccnxHandle->publishData (*ii, ss.str(), m_syncResponseFreshness);
-  }
+      sendSyncInterest();
+    }
 }
 
 void
