diff --git a/ccnx/ccnx-wrapper.cpp b/ccnx/ccnx-wrapper.cpp
index 5a6cfd3..a9f0821 100644
--- a/ccnx/ccnx-wrapper.cpp
+++ b/ccnx/ccnx-wrapper.cpp
@@ -43,11 +43,92 @@
 
 namespace Ccnx {
 
+static int
+ccn_encode_Signature(struct ccn_charbuf *buf,
+                     const char *digest_algorithm,
+                     const void *witness,
+                     size_t witness_size,
+                     const struct ccn_signature *signature,
+                     size_t signature_size)
+{
+    int res = 0;
+
+    if (signature == NULL)
+        return(-1);
+
+    res |= ccn_charbuf_append_tt(buf, CCN_DTAG_Signature, CCN_DTAG);
+
+    if (digest_algorithm != NULL) {
+        res |= ccn_charbuf_append_tt(buf, CCN_DTAG_DigestAlgorithm, CCN_DTAG);
+        res |= ccn_charbuf_append_tt(buf, strlen(digest_algorithm), CCN_UDATA);
+        res |= ccn_charbuf_append_string(buf, digest_algorithm);
+        res |= ccn_charbuf_append_closer(buf);
+    }
+
+    if (witness != NULL) {
+        res |= ccn_charbuf_append_tt(buf, CCN_DTAG_Witness, CCN_DTAG);
+        res |= ccn_charbuf_append_tt(buf, witness_size, CCN_BLOB);
+        res |= ccn_charbuf_append(buf, witness, witness_size);
+        res |= ccn_charbuf_append_closer(buf);
+    }
+
+    res |= ccn_charbuf_append_tt(buf, CCN_DTAG_SignatureBits, CCN_DTAG);
+    res |= ccn_charbuf_append_tt(buf, signature_size, CCN_BLOB);
+    res |= ccn_charbuf_append(buf, signature, signature_size);
+    res |= ccn_charbuf_append_closer(buf);
+    
+    res |= ccn_charbuf_append_closer(buf);
+
+    return(res == 0 ? 0 : -1);
+}
+
+static int
+ccn_pack_ContentObject(struct ccn_charbuf *buf,
+                         const struct ccn_charbuf *Name,
+                         const struct ccn_charbuf *SignedInfo,
+                         const void *data,
+                         size_t size,
+                         const char *digest_algorithm,
+                         const struct ccn_pkey *private_key
+                         )
+{
+    int res = 0;
+    struct ccn_sigc *sig_ctx;
+    struct ccn_signature *signature;
+    struct ccn_charbuf *content_header;
+    size_t closer_start;
+
+    content_header = ccn_charbuf_create();
+    res |= ccn_charbuf_append_tt(content_header, CCN_DTAG_Content, CCN_DTAG);
+    if (size != 0)
+        res |= ccn_charbuf_append_tt(content_header, size, CCN_BLOB);
+    closer_start = content_header->length;
+    res |= ccn_charbuf_append_closer(content_header);
+    if (res < 0)
+        return(-1);
+    sig_ctx = ccn_sigc_create();
+    size_t sig_size = ccn_sigc_signature_max_size(sig_ctx, private_key);
+    signature = (ccn_signature *)calloc(1, sig_size);
+    ccn_sigc_destroy(&sig_ctx);
+    res |= ccn_charbuf_append_tt(buf, CCN_DTAG_ContentObject, CCN_DTAG);
+
+    res |= ccn_encode_Signature(buf, digest_algorithm,
+                                NULL, 0, signature, sig_size);
+    res |= ccn_charbuf_append_charbuf(buf, Name);
+    res |= ccn_charbuf_append_charbuf(buf, SignedInfo);
+    res |= ccnb_append_tagged_blob(buf, CCN_DTAG_Content, data, size);
+    res |= ccn_charbuf_append_closer(buf);
+    free(signature);
+    ccn_charbuf_destroy(&content_header);
+    return(res == 0 ? 0 : -1);
+}
+
 CcnxWrapper::CcnxWrapper()
   : m_handle (0)
   , m_running (true)
   , m_connected (false)
   , m_executor (new Executor(1))
+  , m_keystore(NULL)
 {
   start ();
 }
@@ -81,6 +162,10 @@
 CcnxWrapper::~CcnxWrapper()
 {
   shutdown ();
+  if (m_keystore != NULL)
+  {
+    ccn_keystore_destroy(&m_keystore);
+  }
 }
 
 void
@@ -271,6 +356,58 @@
   return publishData(name, head(content), content.size(), freshness);
 }
 
+int
+CcnxWrapper::publishUnsignedData(const Name &name, const Bytes &content, int freshness)
+{
+  return publishUnsignedData(name, head(content), content.size(), freshness);
+}
+
+int
+CcnxWrapper::publishUnsignedData(const Name &name, const unsigned char *buf, size_t len, int freshness)
+{
+  {
+    UniqueRecLock lock(m_mutex);
+    if (!m_running || !m_connected)
+      {
+        _LOG_TRACE ("<< not running or connected");
+        return -1;
+      }
+  }
+
+  CcnxCharbufPtr ptr = name.toCcnxCharbuf();
+  ccn_charbuf *pname = ptr->getBuf();
+  ccn_charbuf *content = ccn_charbuf_create();
+  ccn_charbuf *signed_info = ccn_charbuf_create();
+
+  if (m_keystore == NULL)
+  {
+    m_keystore = ccn_keystore_create ();
+    string keystoreFile = string(getenv("HOME")) + string("/.ccnx/.ccnx_keystore");
+    if (ccn_keystore_init (m_keystore, (char *)keystoreFile.c_str(), (char*)"Th1s1sn0t8g00dp8ssw0rd.") < 0)
+      BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str(keystoreFile.c_str()));
+  }
+
+  int res = ccn_signed_info_create(signed_info,
+                         ccn_keystore_public_key_digest(m_keystore),
+                         ccn_keystore_public_key_digest_length(m_keystore),
+                         NULL,
+                         CCN_CONTENT_DATA,
+                         freshness,
+                         NULL,
+                         NULL
+                         );
+
+  ccn_pack_ContentObject(content, pname, signed_info, buf, len, NULL,  ccn_keystore_private_key (m_keystore));
+
+  Bytes bytes;
+  readRaw(bytes, content->buf, content->length);
+
+  ccn_charbuf_destroy (&content);
+  ccn_charbuf_destroy (&signed_info);
+
+  return putToCcnd (bytes);
+}
+
 
 static void
 deleterInInterestTuple (tuple<CcnxWrapper::InterestCallback *, ExecutorPtr> *tuple)
@@ -352,6 +489,10 @@
       _LOG_TRACE (">> incomingData content upcall: " << Name (info->content_ccnb, info->content_comps));
       break;
 
+    case CCN_UPCALL_CONTENT_UNVERIFIED:
+      _LOG_TRACE (">> incomingData content unverified upcall: " << Name (info->content_ccnb, info->content_comps));
+      break;
+
     case CCN_UPCALL_INTEREST_TIMED_OUT: {
       if (cp != NULL)
       {
@@ -367,6 +508,7 @@
     }
 
     default:
+      _LOG_TRACE(">> unknown upcall type");
       return CCN_UPCALL_RESULT_OK;
     }
 
diff --git a/ccnx/ccnx-wrapper.h b/ccnx/ccnx-wrapper.h
index b264d14..6cd1791 100644
--- a/ccnx/ccnx-wrapper.h
+++ b/ccnx/ccnx-wrapper.h
@@ -71,6 +71,12 @@
   int
   publishData (const Name &name, const Bytes &content, int freshness = DEFAULT_FRESHNESS/* max value for ccnx*/);
 
+  int
+  publishUnsignedData(const Name &name, const Bytes &content, int freshness = DEFAULT_FRESHNESS);
+
+  int
+  publishUnsignedData(const Name &name, const unsigned char *buf, size_t len, int freshness = DEFAULT_FRESHNESS);
+
   static Name
   getLocalPrefix ();
 
@@ -108,6 +114,7 @@
   bool m_connected;
   std::map<Name, InterestCallback> m_registeredInterests;
   ExecutorPtr m_executor;
+  ccn_keystore *m_keystore;
 };
 
 typedef boost::shared_ptr<CcnxWrapper> CcnxWrapperPtr;
diff --git a/src/content-server.cc b/src/content-server.cc
index fa0ea4c..c84c6b6 100644
--- a/src/content-server.cc
+++ b/src/content-server.cc
@@ -38,7 +38,7 @@
 
 ContentServer::ContentServer(CcnxWrapperPtr ccnx, ActionLogPtr actionLog,
                              const boost::filesystem::path &rootDir,
-                             const Ccnx::Name &deviceName, const std::string &sharedFolderName,
+                             const Ccnx::Name &userName, const std::string &sharedFolderName,
                              const std::string &appName,
                              int freshness)
   : m_ccnx(ccnx)
@@ -46,7 +46,7 @@
   , m_dbFolder(rootDir / ".chronoshare")
   , m_freshness(freshness)
   , m_scheduler (new Scheduler())
-  , m_deviceName (deviceName)
+  , m_userName (userName)
   , m_sharedFolderName (sharedFolderName)
   , m_appName (appName)
 {
@@ -60,9 +60,9 @@
   m_scheduler->shutdown ();
 
   ScopedLock lock (m_mutex);
-  for (PrefixIt it = m_prefixes.begin(); it != m_prefixes.end(); ++it)
+  for (PrefixIt forwardingHint = m_prefixes.begin(); forwardingHint != m_prefixes.end(); ++forwardingHint)
   {
-    m_ccnx->clearInterestFilter (*it);
+    m_ccnx->clearInterestFilter (*forwardingHint);
   }
 
   m_prefixes.clear ();
@@ -75,6 +75,7 @@
   // Format for actions: /<forwarding-hint>/<device_name>/<appname>/action/<shared-folder>/<action-seq>
 
   _LOG_DEBUG (">> content server: register " << forwardingHint);
+
   m_ccnx->setInterestFilter (forwardingHint, bind(&ContentServer::filterAndServe, this, forwardingHint, _1));
 
   ScopedLock lock (m_mutex);
@@ -91,13 +92,13 @@
   m_prefixes.erase (forwardingHint);
 }
 
-void
-ContentServer::filterAndServe (Name forwardingHint, const Name &interest)
-{
-  // Format for files:   /<forwarding-hint>/<device_name>/<appname>/file/<hash>/<segment>
-  // Format for actions: /<forwarding-hint>/<device_name>/<appname>/action/<shared-folder>/<action-seq>
 
-  Name name = interest.getPartialName (forwardingHint.size());
+void
+ContentServer::filterAndServeImpl (const Name &forwardingHint, const Name &name, const Name &interest)
+{
+  // interest for files:   /<forwarding-hint>/<device_name>/<appname>/file/<hash>/<segment>
+  // interest for actions: /<forwarding-hint>/<device_name>/<appname>/action/<shared-folder>/<action-seq>
+
   // name for files:   /<device_name>/<appname>/file/<hash>/<segment>
   // name for actions: /<device_name>/<appname>/action/<shared-folder>/<action-seq>
 
@@ -106,39 +107,50 @@
     string type = name.getCompFromBackAsString (2);
     if (type == "file")
       {
-        serve_File (forwardingHint, interest);
+        serve_File (forwardingHint, name, interest);
       }
     else if (type == "action")
       {
-        serve_Action (forwardingHint, interest);
+        serve_Action (forwardingHint, name, interest);
       }
   }
 }
 
 void
-ContentServer::serve_Action (Name forwardingHint, Name interest)
+ContentServer::filterAndServe (Name forwardingHint, const Name &interest)
+{
+  if (forwardingHint.size () > 0 &&
+      m_userName.size () >= forwardingHint.size () &&
+      m_userName.getPartialName (0, forwardingHint.size ()) == forwardingHint)
+    {
+      filterAndServeImpl (Name ("/"), interest, interest); // try without forwarding hints
+    }
+
+  filterAndServeImpl (forwardingHint, interest.getPartialName (forwardingHint.size()), interest); // always try with hint... :( have to
+}
+
+void
+ContentServer::serve_Action (const Name &forwardingHint, const Name &name, const Name &interest)
 {
   _LOG_DEBUG (">> content server serving ACTION, hint: " << forwardingHint << ", interest: " << interest);
-  m_scheduler->scheduleOneTimeTask (m_scheduler, 0, bind (&ContentServer::serve_Action_Execute, this, forwardingHint, interest), boost::lexical_cast<string>(interest));
+  m_scheduler->scheduleOneTimeTask (m_scheduler, 0, bind (&ContentServer::serve_Action_Execute, this, forwardingHint, name, interest), boost::lexical_cast<string>(name));
   // need to unlock ccnx mutex... or at least don't lock it
 }
 
 void
-ContentServer::serve_File (Name forwardingHint, Name interest)
+ContentServer::serve_File (const Name &forwardingHint, const Name &name, const Name &interest)
 {
   _LOG_DEBUG (">> content server serving FILE, hint: " << forwardingHint << ", interest: " << interest);
 
-  m_scheduler->scheduleOneTimeTask (m_scheduler, 0, bind (&ContentServer::serve_File_Execute, this, forwardingHint, interest), boost::lexical_cast<string>(interest));
+  m_scheduler->scheduleOneTimeTask (m_scheduler, 0, bind (&ContentServer::serve_File_Execute, this, forwardingHint, name, interest), boost::lexical_cast<string>(name));
   // need to unlock ccnx mutex... or at least don't lock it
 }
 
 void
-ContentServer::serve_File_Execute (Name forwardingHint, Name interest)
+ContentServer::serve_File_Execute (const Name &forwardingHint, const Name &name, const Name &interest)
 {
   // forwardingHint: /<forwarding-hint>
   // interest:       /<forwarding-hint>/<device_name>/<appname>/file/<hash>/<segment>
-
-  Name name = interest.getPartialName (forwardingHint.size());
   // name:           /<device_name>/<appname>/file/<hash>/<segment>
 
   int64_t segment = name.getCompFromBackAsInt (0);
@@ -204,12 +216,10 @@
 }
 
 void
-ContentServer::serve_Action_Execute (Name forwardingHint, Name interest)
+ContentServer::serve_Action_Execute (const Name &forwardingHint, const Name &name, const Name &interest)
 {
   // forwardingHint: /<forwarding-hint>
   // interest:       /<forwarding-hint>/<device_name>/<appname>/action/<shared-folder>/<action-seq>
-
-  Name name = interest.getPartialName (forwardingHint.size());
   // name for actions: /<device_name>/<appname>/action/<shared-folder>/<action-seq>
 
   int64_t seqno = name.getCompFromBackAsInt (0);
diff --git a/src/content-server.h b/src/content-server.h
index 13ca2dc..55037b7 100644
--- a/src/content-server.h
+++ b/src/content-server.h
@@ -35,7 +35,7 @@
 {
 public:
   ContentServer(Ccnx::CcnxWrapperPtr ccnx, ActionLogPtr actionLog, const boost::filesystem::path &rootDir,
-                const Ccnx::Name &deviceName, const std::string &sharedFolderName, const std::string &appName,
+                const Ccnx::Name &userName, const std::string &sharedFolderName, const std::string &appName,
                 int freshness = -1);
   ~ContentServer();
 
@@ -51,16 +51,19 @@
   filterAndServe (Ccnx::Name forwardingHint, const Ccnx::Name &interest);
 
   void
-  serve_Action (Ccnx::Name forwardingHint, Ccnx::Name interest);
+  filterAndServeImpl (const Ccnx::Name &forwardingHint, const Ccnx::Name &name, const Ccnx::Name &interest);
 
   void
-  serve_File (Ccnx::Name forwardingHint, Ccnx::Name interest);
+  serve_Action (const Ccnx::Name &forwardingHint, const Ccnx::Name &name, const Ccnx::Name &interest);
 
   void
-  serve_Action_Execute(Ccnx::Name forwardingHint, Ccnx::Name interest);
+  serve_File (const Ccnx::Name &forwardingHint, const Ccnx::Name &name, const Ccnx::Name &interest);
 
   void
-  serve_File_Execute(Ccnx::Name forwardingHint, Ccnx::Name interest);
+  serve_Action_Execute(const Ccnx::Name &forwardingHint, const Ccnx::Name &name, const Ccnx::Name &interest);
+
+  void
+  serve_File_Execute(const Ccnx::Name &forwardingHint, const Ccnx::Name &name, const Ccnx::Name &interest);
 
   void
   flushStaleDbCache();
@@ -82,7 +85,7 @@
   DbCache m_dbCache;
   Mutex m_dbCacheMutex;
 
-  Ccnx::Name  m_deviceName;
+  Ccnx::Name  m_userName;
   std::string m_sharedFolderName;
   std::string m_appName;
 };
diff --git a/src/sync-core.cc b/src/sync-core.cc
index e6a4b01..17cb16d 100644
--- a/src/sync-core.cc
+++ b/src/sync-core.cc
@@ -74,12 +74,6 @@
 }
 
 void
-SyncCore::updateLocalPrefix (const Name &localPrefix)
-{
-  m_log->UpdateLocalLocator (localPrefix);
-}
-
-void
 SyncCore::updateLocalState(sqlite3_int64 seqno)
 {
   m_log->UpdateLocalSeqNo (seqno);
diff --git a/src/sync-core.h b/src/sync-core.h
index c2b427b..7cf4368 100644
--- a/src/sync-core.h
+++ b/src/sync-core.h
@@ -51,9 +51,6 @@
   ~SyncCore();
 
   void
-  updateLocalPrefix (const Ccnx::Name &localPrefix);
-
-  void
   localStateChanged ();
 
   /**
diff --git a/src/sync-log.cc b/src/sync-log.cc
index 74506c6..5bd5703 100644
--- a/src/sync-log.cc
+++ b/src/sync-log.cc
@@ -367,12 +367,19 @@
 }
 
 void
-SyncLog::UpdateLocalLocator (const Ccnx::Name &locator)
+SyncLog::UpdateLocalLocator (const Ccnx::Name &forwardingHint)
 {
-  return UpdateLocator (m_localName, locator);
+  if (m_localName.size () >= forwardingHint.size () &&
+      m_localName.getPartialName (0, forwardingHint.size ()) == forwardingHint)
+    {
+      return UpdateLocator (m_localName, Name ("/")); // "directly" accesible
+    }
+  else
+    {
+      return UpdateLocator (m_localName, forwardingHint);
+    }
 }
 
-
 SyncStateMsgPtr
 SyncLog::FindStateDifferences (const std::string &oldHash, const std::string &newHash, bool includeOldSeq)
 {
diff --git a/test/test-ccnx-wrapper.cc b/test/test-ccnx-wrapper.cc
index 2b99dd3..def7876 100644
--- a/test/test-ccnx-wrapper.cc
+++ b/test/test-ccnx-wrapper.cc
@@ -55,6 +55,7 @@
 
 void dataCallback(const Name &name, Ccnx::PcoPtr pco)
 {
+  cout << " in data callback" << endl;
   BytesPtr content = pco->contentPtr ();
   string msg(reinterpret_cast<const char *> (head (*content)), content->size());
   g_dataCallback_counter ++;
@@ -67,11 +68,36 @@
   g_timeout_counter ++;
 }
 
+void
+setup()
+{
+  if (!c1)
+  {
+    c1 = make_shared<CcnxWrapper> ();
+  }
+  if (!c2)
+  {
+    c2 = make_shared<CcnxWrapper> ();
+  }
+}
+
+void
+teardown()
+{
+  if (c1)
+  {
+    c1.reset();
+  }
+  if (c2)
+  {
+    c2.reset();
+  }
+}
+
+
 BOOST_AUTO_TEST_CASE (BlaCcnxWrapperTest)
 {
-  c1 = make_shared<CcnxWrapper> ();
-  c2 = make_shared<CcnxWrapper> ();
-
+  setup();
   Name prefix1("/c1");
   Name prefix2("/c2");
 
@@ -89,11 +115,14 @@
   // reset
   g_dataCallback_counter = 0;
   g_timeout_counter = 0;
+
+  teardown();
 }
 
 BOOST_AUTO_TEST_CASE (CcnxWrapperSelector)
 {
 
+  setup();
   Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
 
   Selectors selectors;
@@ -120,6 +149,7 @@
   g_dataCallback_counter = 0;
   g_timeout_counter = 0;
 
+  teardown();
 
 }
 
@@ -132,6 +162,7 @@
 
 BOOST_AUTO_TEST_CASE (TestTimeout)
 {
+  setup();
   g_dataCallback_counter = 0;
   g_timeout_counter = 0;
   Closure closure (bind(dataCallback, _1, _2), bind(reexpress, _1, _2, _3));
@@ -146,37 +177,50 @@
   usleep(1000);
   BOOST_CHECK_EQUAL(g_dataCallback_counter, 1);
   BOOST_CHECK_EQUAL(g_timeout_counter, 3);
+  teardown();
 }
 
-BOOST_AUTO_TEST_CASE(Cleanup)
+BOOST_AUTO_TEST_CASE (TestUnsigned)
 {
-  c1.reset ();
-  c2.reset ();
+  setup();
+  string n1 = "/xxxxxx/unsigned/01";
+  Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
+
+  g_dataCallback_counter = 0;
+  c1->sendInterest(Name(n1), closure);
+  usleep(1000);
+  c2->publishUnsignedData(Name(n1), (const unsigned char *)n1.c_str(), n1.size(), 1);
+  usleep(1000);
+  BOOST_CHECK_EQUAL(g_dataCallback_counter, 1);
+  teardown();
 }
-// BOOST_AUTO_TEST_CASE (CcnxWrapperSigningTest)
-// {
-//   Bytes data;
-//   data.resize(1024);
-//   for (int i = 0; i < 1024; i++)
-//   {
-//     data[i] = 'm';
-//   }
 
-//   Name name("/signingtest");
+ BOOST_AUTO_TEST_CASE (CcnxWrapperUnsigningTest)
+ {
+   setup();
+   Bytes data;
+   data.resize(1024);
+   for (int i = 0; i < 1024; i++)
+   {
+     data[i] = 'm';
+   }
 
-//   posix_time::ptime start = posix_time::second_clock::local_time();
-//   for (uint64_t i = 0; i < 10000; i++)
-//   {
-//     Name n = name;
-//     n.appendComp(i);
-//     c1->publishData(n, data, 10);
-//   }
-//   posix_time::ptime end = posix_time::second_clock::local_time();
+   Name name("/unsigningtest");
 
-//   posix_time::time_duration duration = end - start;
+   posix_time::ptime start = posix_time::second_clock::local_time();
+   for (uint64_t i = 0; i < 100000; i++)
+   {
+     Name n = name;
+     n.appendComp(i);
+     c1->publishUnsignedData(n, data, 10);
+   }
+   posix_time::ptime end = posix_time::second_clock::local_time();
 
-//   cout << "Publishing 10000 1K size content objects costs " <<duration.total_milliseconds() << " milliseconds" << endl;
-//   cout << "Average time to publish one content object is " << (double) duration.total_milliseconds() / 10000.0 << " milliseconds" << endl;
-// }
+   posix_time::time_duration duration = end - start;
+
+   cout << "Publishing 100000 1K size content objects costs " <<duration.total_milliseconds() << " milliseconds" << endl;
+   cout << "Average time to publish one content object is " << (double) duration.total_milliseconds() / 100000.0 << " milliseconds" << endl;
+    teardown();
+ }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/test-fs-watcher.cc b/test/test-fs-watcher.cc
index 10e7b95..92fb516 100644
--- a/test/test-fs-watcher.cc
+++ b/test/test-fs-watcher.cc
@@ -13,7 +13,7 @@
 using namespace boost;
 namespace fs = boost::filesystem;
 
-BOOST_AUTO_TEST_SUITE(FsWatcherTests)
+BOOST_AUTO_TEST_SUITE(TestFsWatcher)
 
 void
 onChange(set<string> &files, const fs::path &file)
@@ -173,7 +173,35 @@
     BOOST_CHECK(files.find(filename) != files.end());
   }
 
+  create_file(dir / "add-removal-check.txt", "add-removal-check");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") != files.end());
 
+  fs::remove (dir / "add-removal-check.txt");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") == files.end());
+
+  create_file(dir / "add-removal-check.txt", "add-removal-check");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") != files.end());
+
+  fs::remove (dir / "add-removal-check.txt");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") == files.end());
+
+  create_file(dir / "add-removal-check.txt", "add-removal-check");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") != files.end());
+
+  fs::remove (dir / "add-removal-check.txt");
+  usleep(1200000);
+  BOOST_CHECK (files.find("add-removal-check.txt") == files.end());
+
+  // cleanup
+  if (fs::exists(dir))
+  {
+    fs::remove_all(dir);
+  }
 }
 
 BOOST_AUTO_TEST_SUITE_END()
