diff --git a/model/sync-app-socket.h b/model/sync-app-socket.h
index 38a2657..fb2d271 100644
--- a/model/sync-app-socket.h
+++ b/model/sync-app-socket.h
@@ -62,6 +62,14 @@
    */
   bool publish (const std::string &prefix, uint32_t session, const std::string &dataBuffer, int freshness);
 
+  /**
+   * @brief delete a participant's subtree from the sync tree; SyncLogic will do the work
+	 * this is just a wrapper
+   *
+	 * @param the prefix for the participant
+   */
+	void remove (const std::string &prefix) {m_syncLogic.remove(prefix);}
+
 private:
   CcnxWrapperPtr m_ccnxHandle;
 
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 3102c4e..f9f8537 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -181,55 +181,55 @@
     {
       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;
               SeqNo oldSeq;
               tie (inserted, updated, oldSeq) = m_state.update (info, seq);
-                  
+
               if (updated)
                 {
                   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;
                   SeqNo oldSeq;
                   tie (inserted, updated, oldSeq) = m_state.update (info, seq);
-                  
+
                   if (updated)
                     {
                       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,29 +256,37 @@
 
   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());
-        }
-
-      sendSyncInterest ();
     }
+  
+  sendSyncInterest();
+}
 }
 
 void
-SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
+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);
+  }
+}
+
+void
+SyncLogic::processPendingSyncInterests(DiffStatePtr &diff) 
 {
   recursive_mutex::scoped_lock lock (m_stateMutex);
-
-  NameInfoConstPtr info = StdNameInfo::FindOrCreate (prefix);
-  SeqNo seqN(session, seq);
-  DiffStatePtr diff = make_shared<DiffState>();
-  diff->update(info, seqN);
-  m_state.update(info, seqN);
   diff->setDigest(m_state.getDigest());
   m_log.insert(diff);
 
@@ -292,6 +300,33 @@
 }
 
 void
+SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
+{
+  recursive_mutex::scoped_lock lock (m_stateMutex);
+  NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+  SeqNo seqN(session, seq);
+  m_state.update(info, seqN);
+
+  DiffStatePtr diff = make_shared<DiffState>();
+  diff->update(info, seqN);
+
+  processPendingSyncInterests(diff);
+}
+
+void
+SyncLogic::remove(const string &prefix) 
+{
+  recursive_mutex::scoped_lock lock (m_stateMutex);
+  NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+  m_state.remove(info);	
+
+  DiffStatePtr diff = make_shared<DiffState>();
+  diff->remove(info);
+
+  processPendingSyncInterests(diff);
+}
+
+void
 SyncLogic::sendSyncInterest ()
 {
   recursive_mutex::scoped_lock lock (m_stateMutex);
diff --git a/model/sync-logic.h b/model/sync-logic.h
index d2d9f0f..6c112dd 100644
--- a/model/sync-logic.h
+++ b/model/sync-logic.h
@@ -80,6 +80,12 @@
    */
   void processSyncData (const std::string &name, const std::string &dataBuffer);
 
+  /**
+   * @brief remove a participant's subtree from the sync tree
+   * @param the name prefix for the participant
+   */
+	void remove(const std::string &prefix);
+
 #ifdef _DEBUG
   size_t
   getListChecksSize ()
@@ -96,7 +102,9 @@
   processSyncInterest (DigestConstPtr digest, const std::string &interestname, bool timedProcessing=false);
   
   void sendSyncInterest ();
-  // void checkAgain (const std::string &interest, DigestPtr digest);
+
+	void 
+	processPendingSyncInterests(DiffStatePtr &diff);
 
 private:
   typedef std::list< boost::tuple< boost::system_time, boost::function< void ( ) > > > DelayedChecksList;
