diff --git a/src/interest-table.cpp b/src/interest-table.cpp
index 2b3c9d6..8b98316 100644
--- a/src/interest-table.cpp
+++ b/src/interest-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2012-2017 University of California, Los Angeles
+ * Copyright (c) 2012-2019 University of California, Los Angeles
  *
  * This file is part of ChronoSync, synchronization library for distributed realtime
  * applications for NDN.
@@ -47,7 +47,7 @@
   if (entryLifetime < time::milliseconds::zero())
     entryLifetime = ndn::DEFAULT_INTEREST_LIFETIME;
 
-  request->expirationEvent = m_scheduler.scheduleEvent(entryLifetime, [=] { erase(digest); });
+  request->expirationEvent = m_scheduler.schedule(entryLifetime, [=] { erase(digest); });
 
   m_table.insert(request);
 }
@@ -57,7 +57,7 @@
 {
   auto it = m_table.get<hashed>().find(digest);
   while (it != m_table.get<hashed>().end()) {
-    m_scheduler.cancelEvent((*it)->expirationEvent);
+    (*it)->expirationEvent.cancel();
     m_table.erase(it);
 
     it = m_table.get<hashed>().find(digest);
@@ -83,9 +83,8 @@
 InterestTable::clear()
 {
   for (const auto& item : m_table) {
-    m_scheduler.cancelEvent(item->expirationEvent);
+    item->expirationEvent.cancel();
   }
-
   m_table.clear();
 }
 
diff --git a/src/logic.cpp b/src/logic.cpp
index ead98ae..fa6680d 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -168,8 +168,7 @@
 
   sendSyncInterest();
 
-  m_delayedInterestProcessingId = m_scheduler.scheduleEvent(m_cancelResetTimer,
-                                  bind(&Logic::cancelReset, this));
+  m_delayedInterestProcessingId = m_scheduler.schedule(m_cancelResetTimer, [this] { cancelReset(); });
 }
 
 void
@@ -428,8 +427,8 @@
       // Do not hurry, some others may be also resetting and may send their reply
       time::milliseconds after(m_rangeUniformRandom(m_rng));
       _LOG_DEBUG_ID("After: " << after);
-      m_delayedInterestProcessingId = m_scheduler.scheduleEvent(after,
-                                      bind(&Logic::processSyncInterest, this, interest, true));
+      m_delayedInterestProcessingId = m_scheduler.schedule(after,
+                                                           [=] { processSyncInterest(interest, true); });
     }
     else {
       _LOG_DEBUG_ID("Timed processing in reset");
@@ -461,8 +460,8 @@
     m_interestTable.insert(interest, digest, true);
 
     m_delayedInterestProcessingId =
-      m_scheduler.scheduleEvent(time::milliseconds(m_rangeUniformRandom(m_rng)),
-                                bind(&Logic::processSyncInterest, this, interest, true));
+      m_scheduler.schedule(time::milliseconds(m_rangeUniformRandom(m_rng)),
+                           [=] { processSyncInterest(interest, true); });
   }
   else {
     // OK, nobody is helping us, just tell the truth.
@@ -497,25 +496,24 @@
     reply.wireDecode(syncReplyBlock);
 
     std::vector<MissingDataInfo> v;
-    BOOST_FOREACH(ConstLeafPtr leaf, reply.getLeaves().get<ordered>())
-      {
-        BOOST_ASSERT(leaf != 0);
+    BOOST_FOREACH(ConstLeafPtr leaf, reply.getLeaves().get<ordered>()) {
+      BOOST_ASSERT(leaf != nullptr);
 
-        const Name& info = leaf->getSessionName();
-        SeqNo seq = leaf->getSeq();
+      const Name& info = leaf->getSessionName();
+      SeqNo seq = leaf->getSeq();
 
-        bool isInserted = false;
-        bool isUpdated = false;
-        SeqNo oldSeq;
-        std::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq);
-        if (isInserted || isUpdated) {
-          commit->update(info, seq);
+      bool isInserted = false;
+      bool isUpdated = false;
+      SeqNo oldSeq;
+      std::tie(isInserted, isUpdated, oldSeq) = m_state.update(info, seq);
+      if (isInserted || isUpdated) {
+        commit->update(info, seq);
 
-          oldSeq++;
-          MissingDataInfo mdi = {info, oldSeq, seq};
-          v.push_back(mdi);
-        }
+        oldSeq++;
+        MissingDataInfo mdi = {info, oldSeq, seq};
+        v.push_back(mdi);
       }
+    }
 
     if (!v.empty()) {
       m_onUpdate(v);
@@ -538,8 +536,7 @@
     // state changed and it is safe to express a new interest
     auto after = time::milliseconds(m_reexpressionJitter(m_rng));
     _LOG_DEBUG_ID("Reschedule sync interest after: " << after);
-    m_reexpressingInterestId = m_scheduler.scheduleEvent(after,
-                               bind(&Logic::sendSyncInterest, this));
+    m_reexpressingInterestId = m_scheduler.schedule(after, [this] { sendSyncInterest(); });
   }
 }
 
@@ -589,9 +586,8 @@
     _LOG_DEBUG_ID("Need Period Reset");
     _LOG_DEBUG_ID("ResetTimer: " << m_resetTimer);
 
-    m_resetInterestId = m_scheduler.scheduleEvent(
-                        m_resetTimer + ndn::time::milliseconds(m_reexpressionJitter(m_rng)),
-                        bind(&Logic::sendResetInterest, this));
+    m_resetInterestId = m_scheduler.schedule(m_resetTimer + ndn::time::milliseconds(m_reexpressionJitter(m_rng)),
+                                             [this] { sendResetInterest(); });
   }
 
   Interest interest(m_syncReset);
@@ -623,9 +619,9 @@
   printDigest(m_state.getRootDigest());
 #endif
 
-  m_reexpressingInterestId = m_scheduler.scheduleEvent(m_syncInterestLifetime / 2 +
-                             ndn::time::milliseconds(m_reexpressionJitter(m_rng)),
-                             bind(&Logic::sendSyncInterest, this));
+  m_reexpressingInterestId = m_scheduler.schedule(m_syncInterestLifetime / 2 +
+                                                  ndn::time::milliseconds(m_reexpressionJitter(m_rng)),
+                                                  [this] { sendSyncInterest(); });
 
   Interest interest(interestName);
   interest.setMustBeFresh(true);
@@ -717,7 +713,7 @@
     time::milliseconds after(m_reexpressionJitter(m_rng));
     _LOG_DEBUG_ID("Satisfy our own interest");
     _LOG_DEBUG_ID("Reschedule sync interest after " << after);
-    m_reexpressingInterestId = m_scheduler.scheduleEvent(after, bind(&Logic::sendSyncInterest, this));
+    m_reexpressingInterestId = m_scheduler.schedule(after, [this] { sendSyncInterest(); });
   }
   _LOG_DEBUG_ID("<< Logic::sendSyncData");
 }
