diff --git a/model/sync-interest-table.cc b/model/sync-interest-table.cc
index b9f6484..3a08fbd 100644
--- a/model/sync-interest-table.cc
+++ b/model/sync-interest-table.cc
@@ -21,32 +21,29 @@
  */
 
 #include "sync-interest-table.h"
-
+#include "sync-log.h"
 using namespace std;
 using namespace boost;
 
+INIT_LOGGER ("SyncInterestTable");
+
 namespace Sync
 {
 
 SyncInterestTable::SyncInterestTable ()
-  : m_running (true)
 {
-  m_thread = thread (&SyncInterestTable::periodicCheck, this);
+  m_scheduler.schedule (posix_time::seconds (m_checkPeriod),
+                        bind (&SyncInterestTable::expireInterests, this),
+                        0);
 }
 
 SyncInterestTable::~SyncInterestTable ()
 {
-  // cout << "request interrupt: " << this_thread::get_id () << endl;
-  m_running = false;
-  m_thread.interrupt ();
-  m_thread.join ();
 }
 
 vector<string>
 SyncInterestTable::fetchAll ()
 {
-  expireInterests();
-
   recursive_mutex::scoped_lock lock (m_mutex);
   
   vector<string> entries;
@@ -62,7 +59,7 @@
 }
 
 bool
-SyncInterestTable::insert(string interest)
+SyncInterestTable::insert(const string &interest)
 {
   recursive_mutex::scoped_lock lock (m_mutex);
   TableContainer::iterator it = m_table.find (interest);
@@ -72,41 +69,52 @@
   m_table.insert (make_pair(interest, currentTime));
 }
 
-void SyncInterestTable::expireInterests()
+uint32_t
+SyncInterestTable::size () const
 {
   recursive_mutex::scoped_lock lock (m_mutex);
+  return m_table.size ();
+}
+
+bool
+SyncInterestTable::remove (const std::string &interest)
+{
+  recursive_mutex::scoped_lock lock (m_mutex);
+  TableContainer::iterator item = m_table.find (interest);
+  if (item != m_table.end ())
+    {
+      m_table.erase (item);
+      return true;
+    }
+  return false;
+}
+
+
+void SyncInterestTable::expireInterests ()
+{ 
+  recursive_mutex::scoped_lock lock (m_mutex);
+
+  uint32_t count = 0;
   time_t currentTime = time(0);
   TableContainer::iterator it = m_table.begin (); 
   while (it != m_table.end())
     {
     time_t timestamp = it->second;
-    if (currentTime - timestamp > m_checkPeriod) {
-      it = m_table.erase(it);
-    }
+    if (currentTime - timestamp > m_checkPeriod)
+      {
+        it = m_table.erase(it);
+        count ++;
+      }
     else
       ++it;
   }
+
+  _LOG_DEBUG ("expireInterests (): expired " << count);
+  
+  m_scheduler.schedule (posix_time::seconds (m_checkPeriod),
+                        bind (&SyncInterestTable::expireInterests, this),
+                        0);
 }
 
-void SyncInterestTable::periodicCheck ()
-{
-  while (m_running)
-    {
-      try
-        {
-          // cout << "enterSleep: " << this_thread::get_id () << endl;
-      
-          this_thread::sleep (posix_time::seconds(4));
-          expireInterests ();
-        }
-      catch (boost::thread_interrupted e)
-        {
-          // should I just assign m_running = false here?
-          
-          // cout << "interrupted: " << this_thread::get_id () << endl;
-          // do nothing
-        }
-    }
-}
 
 }
diff --git a/model/sync-interest-table.h b/model/sync-interest-table.h
index bc5f2c2..199d731 100644
--- a/model/sync-interest-table.h
+++ b/model/sync-interest-table.h
@@ -29,6 +29,7 @@
 #include <boost/thread/recursive_mutex.hpp>
 #include <boost/thread/thread.hpp>
 #include <ctime>
+#include "sync-scheduler.h"
 
 namespace Sync {
 
@@ -48,7 +49,14 @@
    * @brief Insert an interest, if interest already exists, update the
    * timestamp
    */
-  bool insert (std::string interest);
+  bool
+  insert (const std::string &interest);
+
+  /**
+   * @brief Remove interest (e.g., when it was satisfied)
+   */
+  bool
+  remove (const std::string &interest);
 
   /**
    * @brief fetch all Interests and clear the table
@@ -56,24 +64,24 @@
   std::vector<std::string>
   fetchAll ();
 
+  uint32_t
+  size () const;
+
 private:
   /**
    * @brief periodically called to expire Interest
    */
-  void expireInterests ();
-
-  void periodicCheck ();
+  void
+  expireInterests ();
 
 private:
   typedef boost::unordered_map<std::string, time_t> TableContainer;
   
   static const int m_checkPeriod = 4;
   TableContainer m_table; // pit entries
-  
-  boost::thread m_thread; // thread to check every 4 sec
-  volatile bool m_running;
-  boost::recursive_mutex m_mutex;
 
+  Scheduler m_scheduler;
+  mutable boost::recursive_mutex m_mutex;
 };
 
 } // Sync
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 2134256..7f052f1 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -34,7 +34,7 @@
 using namespace std;
 using namespace boost;
 
-INIT_LOGGER ("SyncLogic");
+// INIT_LOGGER ("SyncLogic");
 
 namespace Sync
 {
@@ -47,9 +47,16 @@
   , m_onRemove (onRemove)
   , m_ccnxHandle(new CcnxWrapper())
   , m_randomGenerator (static_cast<unsigned int> (std::time (0)))
-  , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (10,50))
+  , m_rangeUniformRandom (m_randomGenerator, uniform_int<> (20,80))
 {
-  _LOG_FUNCTION (syncPrefix);
+#ifdef _DEBUG
+#ifdef HAVE_LOG4CXX
+  // _LOG_FUNCTION (syncPrefix);
+  static int id = 0;
+  staticModuleLogger = log4cxx::Logger::getLogger ("SyncLogic." + lexical_cast<string> (id));
+  id ++;
+#endif
+#endif
   
   m_ccnxHandle->setInterestFilter (m_syncPrefix,
                                    bind (&SyncLogic::respondSyncInterest, this, _1));
@@ -61,7 +68,7 @@
 
 SyncLogic::~SyncLogic ()
 {
-  _LOG_FUNCTION (this);
+  // _LOG_FUNCTION (this);
   // cout << "SyncLogic::~SyncLogic ()" << endl;
 
   m_ccnxHandle.reset ();
@@ -100,9 +107,16 @@
     {
       _LOG_TRACE (">> D " << interestName << "/state" << " (zero)");
 
+      m_syncInterestTable.remove (interestName + "/state");
       m_ccnxHandle->publishData (interestName + "/state",
                                  lexical_cast<string> (m_state),
                                  m_syncResponseFreshness);
+      if (m_outstandingInterest == interestName)
+        {
+          m_scheduler.schedule (posix_time::seconds (0),
+                                bind (&SyncLogic::sendSyncInterest, this),
+                                REEXPRESSING_INTEREST);
+        }
       return;
     }
 
@@ -111,12 +125,12 @@
       // cout << interestName << "\n";
       if (digest->isZero ())
         {
-          _LOG_TRACE ("Digest is zero, adding /state to PIT");
+          _LOG_TRACE ("processSyncInterest (): Digest is zero, adding /state to PIT");
           m_syncInterestTable.insert (interestName + "/state");
         }
       else
         {
-          _LOG_TRACE ("Same state. Adding to PIT");
+          _LOG_TRACE ("processSyncInterest (): Same state. Adding to PIT");
           m_syncInterestTable.insert (interestName);
         }
       return;
@@ -127,16 +141,22 @@
   if (stateInDiffLog != m_log.end ())
   {
     _LOG_TRACE (">> D " << interestName);
-    
+
+    m_syncInterestTable.remove (interestName);
     m_ccnxHandle->publishData (interestName,
                                lexical_cast<string> (*(*stateInDiffLog)->diff ()),
                                m_syncResponseFreshness);
+    if (m_outstandingInterest == interestName)
+      {
+        m_scheduler.schedule (posix_time::seconds (0),
+                              bind (&SyncLogic::sendSyncInterest, this),
+                              REEXPRESSING_INTEREST);
+      }
     return;
   }
 
   if (!timedProcessing)
     {
-      _LOG_DEBUG ("hmm");
       m_scheduler.schedule (posix_time::milliseconds (m_rangeUniformRandom ()) /*from 20 to 100ms*/,
                             bind (&SyncLogic::processSyncInterest, this, digest, interestName, true),
                             DELAYED_INTEREST_PROCESSING);
@@ -145,10 +165,18 @@
   else
     {
       _LOG_TRACE (">> D " << interestName << "/state" << " (timed processing)");
-      
+
+      m_syncInterestTable.remove (interestName + "/state");
       m_ccnxHandle->publishData (interestName + "/state",
                                  lexical_cast<string> (m_state),
                                  m_syncResponseFreshness);
+
+      if (m_outstandingInterest == interestName)
+        {
+          m_scheduler.schedule (posix_time::seconds (0),
+                                bind (&SyncLogic::sendSyncInterest, this),
+                                REEXPRESSING_INTEREST);
+        }
     }
 }
 
@@ -244,14 +272,17 @@
   // if state has changed, then it is safe to express a new interest
   if (diffLog->getLeaves ().size () > 0)
     {
-      sendSyncInterest ();
+      m_scheduler.schedule (posix_time::seconds (0),
+                            bind (&SyncLogic::sendSyncInterest, this),
+                            REEXPRESSING_INTEREST);
     }
   else
     {
       // should not reexpress the same interest. Need at least wait for data lifetime
       // Otherwise we will get immediate reply from the local daemon and there will be 100% utilization
       m_scheduler.cancel (REEXPRESSING_INTEREST);
-      m_scheduler.schedule (posix_time::seconds (m_syncResponseFreshness),
+      // m_scheduler.schedule (posix_time::seconds (0),
+      m_scheduler.schedule (posix_time::seconds (m_syncResponseFreshness) + posix_time::milliseconds (1),
                             bind (&SyncLogic::sendSyncInterest, this),
                             REEXPRESSING_INTEREST);
     }
@@ -265,10 +296,27 @@
     {
       stringstream ss;
       ss << *diffLog;
+      bool satisfiedOwnInterest = false;
+      
       for (vector<string>::iterator ii = pis.begin(); ii != pis.end(); ++ii)
         {
           _LOG_TRACE (">> D " << *ii);
           m_ccnxHandle->publishData (*ii, ss.str(), m_syncResponseFreshness);
+
+          {
+            recursive_mutex::scoped_lock lock (m_stateMutex);
+            // _LOG_DEBUG (*ii << " == " << m_outstandingInterest << " = " << (*ii == m_outstandingInterest));
+            satisfiedOwnInterest = satisfiedOwnInterest || (*ii == m_outstandingInterest) || (*ii == (m_outstandingInterest + "/state"));
+          }
+        }
+
+      if (satisfiedOwnInterest)
+        {
+          _LOG_DEBUG ("Have satisfied our own interest. Scheduling interest reexpression");
+          // we need to reexpress interest only if we satisfied our own interest
+          m_scheduler.schedule (posix_time::milliseconds (0),
+                                bind (&SyncLogic::sendSyncInterest, this),
+                                REEXPRESSING_INTEREST);
         }
     }
 }
@@ -285,7 +333,7 @@
   m_log.erase (m_state.getDigest()); // remove diff state with the same digest.  next pointers are still valid
   /// @todo Optimization
   m_log.get<sequenced> ().push_front (diffLog);
-  _LOG_DEBUG (*diffLog->getDigest () << " " << m_log.size ());
+  // _LOG_DEBUG (*diffLog->getDigest () << " " << m_log.size ());
 }
 
 void
@@ -296,16 +344,19 @@
     //cout << "Add local names" <<endl;
     recursive_mutex::scoped_lock lock (m_stateMutex);
     NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
-  
+
     SeqNo seqN (session, seq);
     m_state.update(info, seqN);
 
+    _LOG_DEBUG ("addLocalNames (): new state " << *m_state.getDigest ());
+    
     diff = make_shared<DiffState>();
     diff->update(info, seqN);
     processPendingSyncInterests (diff);
   }
 
-  satisfyPendingSyncInterests (diff);
+  // _LOG_DEBUG ("PIT size: " << m_syncInterestTable.size ());
+  satisfyPendingSyncInterests (diff);  
 }
 
 void
@@ -323,20 +374,25 @@
     processPendingSyncInterests (diff);
   }
 
-  satisfyPendingSyncInterests (diff);
+  satisfyPendingSyncInterests (diff);  
 }
 
 void
 SyncLogic::sendSyncInterest ()
 {
-  // cout << "Sending Sync Interest" << endl;
-  recursive_mutex::scoped_lock lock (m_stateMutex);
-
   ostringstream os;
-  os << m_syncPrefix << "/" << *m_state.getDigest();
 
-  _LOG_TRACE (">> I " << os.str ());
+  {
+    // cout << "Sending Sync Interest" << endl;
+    recursive_mutex::scoped_lock lock (m_stateMutex);
 
+    os << m_syncPrefix << "/" << *m_state.getDigest();
+
+    _LOG_TRACE (">> I " << os.str ());
+
+    m_outstandingInterest = os.str ();
+  }
+  
   m_ccnxHandle->sendInterest (os.str (),
                               bind (&SyncLogic::processSyncData, this, _1, _2));
 
diff --git a/model/sync-logic.h b/model/sync-logic.h
index 871ee33..e966dea 100644
--- a/model/sync-logic.h
+++ b/model/sync-logic.h
@@ -37,6 +37,12 @@
 
 #include "sync-diff-state-container.h"
 
+#ifdef _DEBUG
+#ifdef HAVE_LOG4CXX
+#include <log4cxx/logger.h>
+#endif
+#endif
+
 namespace Sync {
 
 /**
@@ -114,6 +120,7 @@
   DiffStateContainer m_log;
   boost::recursive_mutex m_stateMutex;
 
+  std::string m_outstandingInterest;
   SyncInterestTable m_syncInterestTable;
 
   std::string m_syncPrefix;
@@ -133,6 +140,12 @@
       DELAYED_INTEREST_PROCESSING = 1,
       REEXPRESSING_INTEREST = 2
     };
+
+#ifdef _DEBUG
+#ifdef HAVE_LOG4CXX
+  log4cxx::LoggerPtr staticModuleLogger;
+#endif
+#endif  
 };
 
 
diff --git a/model/sync-scheduler.cc b/model/sync-scheduler.cc
index f54f91f..73a904a 100644
--- a/model/sync-scheduler.cc
+++ b/model/sync-scheduler.cc
@@ -66,13 +66,13 @@
 	    nextTime = m_events.begin ()->time;
           }
 
-	  if (nextTime - get_system_time () > posix_time::time_duration (0,0,0,0))
+	  if (nextTime > get_system_time ())
 	    {
 	      this_thread::sleep (nextTime - get_system_time ());
 
 	      // sleeping
 
-	      if (nextTime - get_system_time () > posix_time::time_duration (0,0,0,0))
+	      if (nextTime > get_system_time ())
                 {
                   // cout << "expected here" << endl;
                   continue; // something changes, try again
