diff --git a/model/sync-interest-table.cc b/model/sync-interest-table.cc
index 0ec430c..b9f6484 100644
--- a/model/sync-interest-table.cc
+++ b/model/sync-interest-table.cc
@@ -28,52 +28,85 @@
 namespace Sync
 {
 
-vector<string> SyncInterestTable::fetchAll()
+SyncInterestTable::SyncInterestTable ()
+  : m_running (true)
 {
-	expireInterests();
-
-	recursive_mutex::scoped_lock lock(m_mutex);
-	vector<string> entries;
-	for (unordered_map<string, time_t>::iterator it = m_table.begin(); it !=
-		m_table.end(); ++it) {
-		entries.push_back(it->first);
-	}
-	m_table.clear();
-
-	return entries;
+  m_thread = thread (&SyncInterestTable::periodicCheck, this);
 }
 
-bool SyncInterestTable::insert(string interest)
+SyncInterestTable::~SyncInterestTable ()
 {
-	recursive_mutex::scoped_lock lock(m_mutex);
-	unordered_map<string, time_t>::iterator it = m_table.find(interest);
-	if (it != m_table.end())
-		m_table.erase(it);
-	time_t currentTime = time(0);
-	m_table.insert(make_pair(interest, currentTime));
+  // cout << "request interrupt: " << this_thread::get_id () << endl;
+  m_running = false;
+  m_thread.interrupt ();
+  m_thread.join ();
 }
 
-SyncInterestTable::SyncInterestTable() {
-	m_thread = thread(&SyncInterestTable::periodicCheck, this);
+vector<string>
+SyncInterestTable::fetchAll ()
+{
+  expireInterests();
+
+  recursive_mutex::scoped_lock lock (m_mutex);
+  
+  vector<string> entries;
+  for (unordered_map<string, time_t>::iterator it = m_table.begin();
+       it != m_table.end();
+       ++it)
+    {
+      entries.push_back(it->first);
+    }
+  m_table.clear ();
+
+  return entries;
 }
 
-void SyncInterestTable::expireInterests() {
-	recursive_mutex::scoped_lock lock(m_mutex);
-	time_t currentTime = time(0);
-	unordered_map<string, time_t>::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);
-		}
-		else
-			++it;
-	}
+bool
+SyncInterestTable::insert(string interest)
+{
+  recursive_mutex::scoped_lock lock (m_mutex);
+  TableContainer::iterator it = m_table.find (interest);
+  if (it != m_table.end())
+    m_table.erase(it);
+  time_t currentTime = time(0);
+  m_table.insert (make_pair(interest, currentTime));
 }
 
-void SyncInterestTable::periodicCheck() {
-	sleep(4);
-	expireInterests();
+void SyncInterestTable::expireInterests()
+{
+  recursive_mutex::scoped_lock lock (m_mutex);
+  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);
+    }
+    else
+      ++it;
+  }
+}
+
+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 f850708..bc5f2c2 100644
--- a/model/sync-interest-table.h
+++ b/model/sync-interest-table.h
@@ -30,11 +30,6 @@
 #include <boost/thread/thread.hpp>
 #include <ctime>
 
-/**
- * \defgroup sync SYNC protocol
- *
- * Implementation of SYNC protocol
- */
 namespace Sync {
 
 /**
@@ -46,32 +41,38 @@
 class SyncInterestTable
 {
 public:
-	SyncInterestTable();
+  SyncInterestTable ();
+  ~SyncInterestTable ();
 
-	/**
-	 * @brief Insert an interest, if interest already exists, update the
-	 * timestamp
-	 */
-	bool insert(std::string interest);
+  /**
+   * @brief Insert an interest, if interest already exists, update the
+   * timestamp
+   */
+  bool insert (std::string interest);
 
-	/**
-	 * @brief fetch all Interests and clear the table
-	 */
-	std::vector<std::string> fetchAll();
+  /**
+   * @brief fetch all Interests and clear the table
+   */
+  std::vector<std::string>
+  fetchAll ();
 
 private:
-	/**
-	 * @brief periodically called to expire Interest
-	 */
-	void expireInterests();
+  /**
+   * @brief periodically called to expire Interest
+   */
+  void expireInterests ();
 
-	void periodicCheck();
+  void periodicCheck ();
 
 private:
-	static const int m_checkPeriod = 4;
-	boost::unordered_map<std::string, time_t> m_table; // pit entries
-	boost::thread m_thread; // thread to check every 4 sec
-	boost::recursive_mutex m_mutex;
+  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;
 
 };
 
