diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 67c948f..c068905 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -17,7 +17,6 @@
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
-#include "hello-protocol.hpp"
 
 #include "hello-protocol.hpp"
 #include "nlsr.hpp"
@@ -91,10 +90,7 @@
 {
   NLSR_LOG_DEBUG("Scheduling HELLO Interests in " << ndn::time::seconds(seconds));
 
-  m_scheduler.scheduleEvent(ndn::time::seconds(seconds),
-                            [this] {
-                              sendScheduledInterest();
-                            });
+  m_scheduler.schedule(ndn::time::seconds(seconds), [this] { sendScheduledInterest(); });
 }
 
 void
diff --git a/src/lsa-segment-storage.cpp b/src/lsa-segment-storage.cpp
index 830906d..e7d6f2d 100644
--- a/src/lsa-segment-storage.cpp
+++ b/src/lsa-segment-storage.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  The University of Memphis,
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -140,10 +140,8 @@
 {
   NLSR_LOG_TRACE("Scheduling LSA segment deletion for "
                  << lsaSegmentsKey << " in: " << expirationTime);
-  m_scheduler.scheduleEvent(expirationTime,
-                            [lsaSegmentsKey, this] {
-                              m_lsaSegments.erase(lsaSegmentsKey);
-                            });
+  m_scheduler.schedule(expirationTime,
+                       [lsaSegmentsKey, this] { m_lsaSegments.erase(lsaSegmentsKey); });
 }
 
 } // namespace nlsr
diff --git a/src/lsa.hpp b/src/lsa.hpp
index 54a2c75..13a5b6c 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -26,7 +26,6 @@
 #include "adjacent.hpp"
 #include "adjacency-list.hpp"
 
-#include <boost/cstdint.hpp>
 #include <ndn-cxx/util/scheduler.hpp>
 #include <ndn-cxx/util/time.hpp>
 #include <boost/tokenizer.hpp>
@@ -44,14 +43,6 @@
     MOCK
   };
 
-  Lsa()
-    : m_origRouter()
-    , m_lsSeqNo()
-    , m_expirationTimePoint()
-    , m_expiringEventId()
-  {
-  }
-
   virtual
   ~Lsa() = default;
 
@@ -98,12 +89,12 @@
   }
 
   void
-  setExpiringEventId(const ndn::EventId leei)
+  setExpiringEventId(ndn::scheduler::EventId eid)
   {
-    m_expiringEventId = leei;
+    m_expiringEventId = std::move(eid);
   }
 
-  ndn::EventId
+  ndn::scheduler::EventId
   getExpiringEventId() const
   {
     return m_expiringEventId;
@@ -151,17 +142,15 @@
 
 protected:
   ndn::Name m_origRouter;
-  uint32_t m_lsSeqNo;
+  uint32_t m_lsSeqNo = 0;
   ndn::time::system_clock::TimePoint m_expirationTimePoint;
-  ndn::EventId m_expiringEventId;
+  ndn::scheduler::EventId m_expiringEventId;
 };
 
 class NameLsa : public Lsa
 {
 public:
-  NameLsa()
-  {
-  }
+  NameLsa() = default;
 
   NameLsa(const ndn::Name& origR, uint32_t lsn,
           const ndn::time::system_clock::TimePoint& lt,
@@ -235,9 +224,7 @@
 public:
   typedef AdjacencyList::const_iterator const_iterator;
 
-  AdjLsa()
-  {
-  }
+  AdjLsa() = default;
 
   AdjLsa(const ndn::Name& origR, uint32_t lsn,
          const ndn::time::system_clock::TimePoint& lt,
@@ -320,10 +307,7 @@
 class CoordinateLsa : public Lsa
 {
 public:
-  CoordinateLsa()
-    : m_corRad(0)
-  {
-  }
+  CoordinateLsa() = default;
 
   CoordinateLsa(const ndn::Name& origR, uint32_t lsn,
                 const ndn::time::system_clock::TimePoint& lt,
@@ -349,13 +333,13 @@
   double
   getCorRadius() const
   {
-      return m_corRad;
+    return m_corRad;
   }
 
   void
   setCorRadius(double cr)
   {
-      m_corRad = cr;
+    m_corRad = cr;
   }
 
   const std::vector<double>
@@ -385,7 +369,7 @@
   serialize() const override;
 
 private:
-  double m_corRad;
+  double m_corRad = 0.0;
   std::vector<double> m_angles;
 
   friend std::ostream&
@@ -410,8 +394,8 @@
 } // namespace nlsr
 
 namespace std {
-  std::string
-  to_string(const nlsr::Lsa::Type& type);
+std::string
+to_string(const nlsr::Lsa::Type& type);
 } // namespace std
 
 #endif // NLSR_LSA_HPP
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 4159c4f..58963f4 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -85,11 +85,10 @@
                       uint64_t seqNo)
 {
   NLSR_LOG_DEBUG("Failed to fetch LSA: " << lsaName << ", Error code: " << errorCode
-                                                << ", Message: " << msg);
+                 << ", Message: " << msg);
 
   if (ndn::time::steady_clock::now() < deadline) {
-    SequenceNumberMap::const_iterator it = m_highestSeqNo.find(lsaName);
-
+    auto it = m_highestSeqNo.find(lsaName);
     if (it != m_highestSeqNo.end() && it->second == seqNo) {
       // If the SegmentFetcher failed due to an Interest timeout, it is safe to re-express
       // immediately since at the least the LSA Interest lifetime has elapsed.
@@ -101,8 +100,8 @@
         delay = ndn::time::seconds(0);
       }
 
-      m_scheduler.scheduleEvent(delay, std::bind(&Lsdb::expressInterest, this,
-                                                 interestName, retransmitNo + 1, deadline));
+      m_scheduler.schedule(delay, std::bind(&Lsdb::expressInterest, this,
+                                            interestName, retransmitNo + 1, deadline));
     }
   }
 }
@@ -132,12 +131,6 @@
   onContentValidated(data);
 }
 
-void
-Lsdb::cancelScheduleLsaExpiringEvent(ndn::EventId eid)
-{
-  m_scheduler.cancelEvent(eid);
-}
-
   /*! \brief Compares if a name LSA is the same as the one specified by key
 
     \param nlsa1 A name LSA object
@@ -167,13 +160,12 @@
 NameLsa*
 Lsdb::findNameLsa(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
   if (it != m_nameLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
@@ -181,7 +173,7 @@
 {
   NameLsa* nameLsaCheck = findNameLsa(key);
   // Is the name in the LSDB
-  if (nameLsaCheck != 0) {
+  if (nameLsaCheck != nullptr) {
     // And the supplied seq no is the highest so far
     if (nameLsaCheck->getLsSeqNo() < seqNo) {
       return true;
@@ -193,12 +185,12 @@
   return true;
 }
 
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
                                 const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshNameLsa, this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshNameLsa, this, key, seqNo));
 }
 
 bool
@@ -208,7 +200,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   NameLsa* chkNameLsa = findNameLsa(nlsa.getKey());
   // Determines if the name LSA is new or not.
-  if (chkNameLsa == 0) {
+  if (chkNameLsa == nullptr) {
     addNameLsa(nlsa);
     NLSR_LOG_DEBUG("New Name LSA");
     NLSR_LOG_DEBUG("Adding Name Lsa");
@@ -283,11 +275,10 @@
       }
 
       if (nlsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = nlsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = nlsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkNameLsa->getExpiringEventId());
+      chkNameLsa->getExpiringEventId().cancel();
       chkNameLsa->setExpiringEventId(scheduleNameLsaExpiration(nlsa.getKey(),
                                                                nlsa.getLsSeqNo(),
                                                                timeToExpire));
@@ -301,10 +292,8 @@
 bool
 Lsdb::addNameLsa(NameLsa& nlsa)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1,
-                                                      nlsa.getKey()));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, nlsa.getKey()));
   if (it == m_nameLsdb.end()) {
     m_nameLsdb.push_back(nlsa);
     return true;
@@ -315,16 +304,15 @@
 bool
 Lsdb::removeNameLsa(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
   if (it != m_nameLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Name Lsa");
-    (*it).writeLog();
+    it->writeLog();
     // If the requested name LSA is not ours, we also need to remove
     // its entries from the NPT.
-    if ((*it).getOrigRouter() != m_confParam.getRouterPrefix()) {
-      m_namePrefixTable.removeEntry((*it).getOrigRouter(), (*it).getOrigRouter());
+    if (it->getOrigRouter() != m_confParam.getRouterPrefix()) {
+      m_namePrefixTable.removeEntry(it->getOrigRouter(), it->getOrigRouter());
 
       for (const auto& name : it->getNpl().getNames()) {
         if (name != m_confParam.getRouterPrefix()) {
@@ -341,13 +329,9 @@
 bool
 Lsdb::doesNameLsaExist(const ndn::Name& key)
 {
-  std::list<NameLsa>::iterator it = std::find_if(m_nameLsdb.begin(),
-                                                 m_nameLsdb.end(),
-                                                 std::bind(nameLsaCompareByKey, _1, key));
-  if (it == m_nameLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_nameLsdb.begin(), m_nameLsdb.end(),
+                         std::bind(nameLsaCompareByKey, _1, key));
+  return it != m_nameLsdb.end();
 }
 
 void
@@ -401,13 +385,12 @@
 CoordinateLsa*
 Lsdb::findCoordinateLsa(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
   if (it != m_corLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
@@ -415,7 +398,7 @@
 {
   CoordinateLsa* clsa = findCoordinateLsa(key);
   // Is the coordinate LSA in the LSDB already
-  if (clsa != 0) {
+  if (clsa != nullptr) {
     // And the seq no is newer (higher) than the current one
     if (clsa->getLsSeqNo() < seqNo) {
       return true;
@@ -431,13 +414,12 @@
   // \param key The name of the router that published the LSA.
   // \param seqNo the seq. no. associated with the LSA to check.
   // \param expTime How long to wait before triggering the event.
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
                                       const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshCoordinateLsa,
-                                             this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshCoordinateLsa, this, key, seqNo));
 }
 
 bool
@@ -446,7 +428,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   CoordinateLsa* chkCorLsa = findCoordinateLsa(clsa.getKey());
   // Checking whether the LSA is new or not.
-  if (chkCorLsa == 0) {
+  if (chkCorLsa == nullptr) {
     NLSR_LOG_DEBUG("New Coordinate LSA. Adding to LSDB");
     NLSR_LOG_DEBUG("Adding Coordinate Lsa");
     clsa.writeLog();
@@ -487,11 +469,10 @@
       }
       // If this is an LSA from another router, refresh its expiration time.
       if (clsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = clsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = clsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkCorLsa->getExpiringEventId());
+      chkCorLsa->getExpiringEventId().cancel();
       chkCorLsa->setExpiringEventId(scheduleCoordinateLsaExpiration(clsa.getKey(),
                                                                     clsa.getLsSeqNo(),
                                                                     timeToExpire));
@@ -505,10 +486,8 @@
 bool
 Lsdb::addCoordinateLsa(CoordinateLsa& clsa)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey, _1,
-                                                                 clsa.getKey()));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, clsa.getKey()));
   if (it == m_corLsdb.end()) {
     m_corLsdb.push_back(clsa);
     return true;
@@ -519,10 +498,9 @@
 bool
 Lsdb::removeCoordinateLsa(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey,
-                                                                 _1, key));
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
+
   if (it != m_corLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Coordinate Lsa");
     it->writeLog();
@@ -540,14 +518,9 @@
 bool
 Lsdb::doesCoordinateLsaExist(const ndn::Name& key)
 {
-  std::list<CoordinateLsa>::iterator it = std::find_if(m_corLsdb.begin(),
-                                                       m_corLsdb.end(),
-                                                       std::bind(corLsaCompareByKey,
-                                                                 _1, key));
-  if (it == m_corLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_corLsdb.begin(), m_corLsdb.end(),
+                         std::bind(corLsaCompareByKey, _1, key));
+  return it != m_corLsdb.end();
 }
 
 void
@@ -591,7 +564,7 @@
   if (m_isBuildAdjLsaSheduled == false) {
     NLSR_LOG_DEBUG("Scheduling Adjacency LSA build in " << m_adjLsaBuildInterval);
 
-    m_scheduler.scheduleEvent(m_adjLsaBuildInterval, std::bind(&Lsdb::buildAdjLsa, this));
+    m_scheduler.schedule(m_adjLsaBuildInterval, [this] { buildAdjLsa(); });
     m_isBuildAdjLsaSheduled = true;
   }
 }
@@ -640,18 +613,15 @@
     m_isBuildAdjLsaSheduled = true;
     int schedulingTime = m_confParam.getInterestRetryNumber() *
                          m_confParam.getInterestResendTime();
-    m_scheduler.scheduleEvent(ndn::time::seconds(schedulingTime),
-                              std::bind(&Lsdb::buildAdjLsa, this));
+    m_scheduler.schedule(ndn::time::seconds(schedulingTime), [this] { buildAdjLsa(); });
   }
 }
 
 bool
 Lsdb::addAdjLsa(AdjLsa& alsa)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1,
-                                                     alsa.getKey()));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, alsa.getKey()));
   if (it == m_adjLsdb.end()) {
     m_adjLsdb.push_back(alsa);
     // Add any new name prefixes to the NPT
@@ -669,21 +639,20 @@
 AdjLsa*
 Lsdb::findAdjLsa(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
   if (it != m_adjLsdb.end()) {
-    return &(*it);
+    return &*it;
   }
-  return 0;
+  return nullptr;
 }
 
 bool
 Lsdb::isAdjLsaNew(const ndn::Name& key, uint64_t seqNo)
 {
-  AdjLsa*  adjLsaCheck = findAdjLsa(key);
+  AdjLsa* adjLsaCheck = findAdjLsa(key);
   // If it is in the LSDB
-  if (adjLsaCheck != 0) {
+  if (adjLsaCheck != nullptr) {
     // And the supplied seq no is newer (higher) than the current one.
     if (adjLsaCheck->getLsSeqNo() < seqNo) {
       return true;
@@ -695,12 +664,12 @@
   return true;
 }
 
-ndn::EventId
+ndn::scheduler::EventId
 Lsdb::scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
                                const ndn::time::seconds& expTime)
 {
-  return m_scheduler.scheduleEvent(expTime + GRACE_PERIOD,
-                                   std::bind(&Lsdb::expireOrRefreshAdjLsa, this, key, seqNo));
+  return m_scheduler.schedule(expTime + GRACE_PERIOD,
+                              std::bind(&Lsdb::expireOrRefreshAdjLsa, this, key, seqNo));
 }
 
 bool
@@ -709,7 +678,7 @@
   ndn::time::seconds timeToExpire = m_lsaRefreshTime;
   AdjLsa* chkAdjLsa = findAdjLsa(alsa.getKey());
   // If this adj. LSA is not in the LSDB already
-  if (chkAdjLsa == 0) {
+  if (chkAdjLsa == nullptr) {
     NLSR_LOG_DEBUG("New Adj LSA. Adding to LSDB");
     NLSR_LOG_DEBUG("Adding Adj Lsa");
     alsa.writeLog();
@@ -721,8 +690,7 @@
                                                    ndn::time::system_clock::now();
       timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
     }
-    scheduleAdjLsaExpiration(alsa.getKey(),
-                             alsa.getLsSeqNo(), timeToExpire);
+    scheduleAdjLsaExpiration(alsa.getKey(), alsa.getLsSeqNo(), timeToExpire);
   }
   else {
     if (chkAdjLsa->getLsSeqNo() < alsa.getLsSeqNo()) {
@@ -741,11 +709,10 @@
         m_routingTable.scheduleRoutingTableCalculation();
       }
       if (alsa.getOrigRouter() != m_confParam.getRouterPrefix()) {
-        ndn::time::system_clock::Duration duration = alsa.getExpirationTimePoint() -
-                                                     ndn::time::system_clock::now();
+        auto duration = alsa.getExpirationTimePoint() - ndn::time::system_clock::now();
         timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(duration);
       }
-      cancelScheduleLsaExpiringEvent(chkAdjLsa->getExpiringEventId());
+      chkAdjLsa->getExpiringEventId().cancel();
       chkAdjLsa->setExpiringEventId(scheduleAdjLsaExpiration(alsa.getKey(),
                                                              alsa.getLsSeqNo(),
                                                              timeToExpire));
@@ -778,9 +745,9 @@
 bool
 Lsdb::removeAdjLsa(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
+
   if (it != m_adjLsdb.end()) {
     NLSR_LOG_DEBUG("Deleting Adj Lsa");
     it->writeLog();
@@ -796,13 +763,9 @@
 bool
 Lsdb::doesAdjLsaExist(const ndn::Name& key)
 {
-  std::list<AdjLsa>::iterator it = std::find_if(m_adjLsdb.begin(),
-                                                m_adjLsdb.end(),
-                                                std::bind(adjLsaCompareByKey, _1, key));
-  if (it == m_adjLsdb.end()) {
-    return false;
-  }
-  return true;
+  auto it = std::find_if(m_adjLsdb.begin(), m_adjLsdb.end(),
+                         std::bind(adjLsaCompareByKey, _1, key));
+  return it != m_adjLsdb.end();
 }
 
 const std::list<AdjLsa>&
@@ -825,7 +788,7 @@
   NLSR_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
   NameLsa* chkNameLsa = findNameLsa(lsaKey);
   // If this name LSA exists in the LSDB
-  if (chkNameLsa != 0) {
+  if (chkNameLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkNameLsa->getLsSeqNo());
     // If its seq no is the one we are expecting.
     if (chkNameLsa->getLsSeqNo() == seqNo) {
@@ -868,7 +831,7 @@
   NLSR_LOG_DEBUG("LSA Key: " << lsaKey << " Seq No: " << seqNo);
   AdjLsa* chkAdjLsa = findAdjLsa(lsaKey);
   // If this is a valid LSA
-  if (chkAdjLsa != 0) {
+  if (chkAdjLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkAdjLsa->getLsSeqNo());
     // And if it hasn't been updated for some other reason
     if (chkAdjLsa->getLsSeqNo() == seqNo) {
@@ -916,7 +879,7 @@
   NLSR_LOG_DEBUG("LSA Key : " << lsaKey << " Seq No: " << seqNo);
   CoordinateLsa* chkCorLsa = findCoordinateLsa(lsaKey);
   // Whether the LSA is in the LSDB or not.
-  if (chkCorLsa != 0) {
+  if (chkCorLsa != nullptr) {
     NLSR_LOG_DEBUG("LSA Exists with seq no: " << chkCorLsa->getLsSeqNo());
     // Whether the LSA has been updated without our knowledge.
     if (chkCorLsa->getLsSeqNo() == seqNo) {
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 0ce9902..2c68906 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -277,7 +277,7 @@
     \param seqNo The seq. no. associated with the LSA.
     \param expTime How many seconds to wait before triggering the event.
    */
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
                             const ndn::time::seconds& expTime);
 
@@ -294,22 +294,21 @@
     \param seqNo The sequence number of the LSA to check.
     \param expTime The number of seconds to wait before triggering the event.
   */
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
                            const ndn::time::seconds& expTime);
 
 private:
-
   void
   expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
 
-  ndn::EventId
+  ndn::scheduler::EventId
   scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
                                   const ndn::time::seconds& expTime);
 
   void
   expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
-                                uint64_t seqNo);
+                               uint64_t seqNo);
 
 private:
 
@@ -379,10 +378,6 @@
   ndn::time::system_clock::TimePoint
   getLsaExpirationTimePoint();
 
-  /*! \brief Cancels an event in the event scheduler. */
-  void
-  cancelScheduleLsaExpiringEvent(ndn::EventId eid);
-
 public:
   static const ndn::Name::Component NAME_COMPONENT;
 
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 78e6d0c..4dc536a 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -561,7 +561,7 @@
 {
   NLSR_LOG_DEBUG("Scheduling Dataset Fetch in " << m_confParam.getFaceDatasetFetchInterval());
 
-  m_scheduler.scheduleEvent(m_confParam.getFaceDatasetFetchInterval(),
+  m_scheduler.schedule(m_confParam.getFaceDatasetFetchInterval(),
     [this] {
       this->initializeFaces(
         [this] (const std::vector<ndn::nfd::FaceStatus>& faces) {
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index 2d653ad..248c0fd 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  The University of Memphis,
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -30,18 +30,11 @@
 class FibEntry
 {
 public:
-  FibEntry()
-    : m_name()
-    , m_seqNo(1)
-    , m_nexthopList()
-  {
-  }
+  FibEntry() = default;
 
   FibEntry(const ndn::Name& name)
-    : m_seqNo(1)
-    , m_nexthopList()
+    : m_name(name)
   {
-    m_name = name;
   }
 
   const ndn::Name&
@@ -57,12 +50,12 @@
   }
 
   void
-  setRefreshEventId(ndn::EventId id)
+  setRefreshEventId(ndn::scheduler::EventId id)
   {
-    m_refreshEventId = id;
+    m_refreshEventId = std::move(id);
   }
 
-  ndn::EventId
+  ndn::scheduler::EventId
   getRefreshEventId() const
   {
     return m_refreshEventId;
@@ -93,8 +86,8 @@
 
 private:
   ndn::Name m_name;
-  ndn::EventId m_refreshEventId;
-  int32_t m_seqNo;
+  ndn::scheduler::EventId m_refreshEventId;
+  int32_t m_seqNo = 1;
   NexthopList m_nexthopList;
 };
 
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 1da774b..5966108 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -49,7 +49,7 @@
 Fib::remove(const ndn::Name& name)
 {
   NLSR_LOG_DEBUG("Fib::remove called");
-  std::map<ndn::Name, FibEntry>::iterator it = m_table.find(name);
+  auto it = m_table.find(name);
 
   // Only unregister the prefix if it ISN'T a neighbor.
   if (it != m_table.end() && isNotNeighbor((it->second).getName())) {
@@ -96,12 +96,11 @@
   unsigned int nFaces = 0;
 
   // Create a list of next hops to be installed with length == maxFaces
-  for (NexthopList::iterator it = allHops.cbegin(); it != allHops.cend() && nFaces < maxFaces;
-       ++it, ++nFaces) {
+  for (auto it = allHops.cbegin(); it != allHops.cend() && nFaces < maxFaces; ++it, ++nFaces) {
     hopsToAdd.addNextHop(*it);
   }
 
-  std::map<ndn::Name, FibEntry>::iterator entryIt = m_table.find(name);
+  auto entryIt = m_table.find(name);
 
   // New FIB entry that has nextHops
   if (entryIt == m_table.end() && hopsToAdd.size() != 0) {
@@ -236,7 +235,7 @@
   NLSR_LOG_DEBUG(message << ": " << commandSuccessResult.getName() <<
                  " Face Uri: " << faceUri << " faceId: " << commandSuccessResult.getFaceId());
 
-  AdjacencyList::iterator adjacent = m_adjacencyList.findAdjacent(faceUri);
+  auto adjacent = m_adjacencyList.findAdjacent(faceUri);
   if (adjacent != m_adjacencyList.end()) {
     adjacent->setFaceId(commandSuccessResult.getFaceId());
   }
@@ -311,29 +310,24 @@
     .setStrategy(strategy);
 
   m_controller.start<ndn::nfd::StrategyChoiceSetCommand>(parameters,
-                                                         std::bind(&Fib::onSetStrategySuccess, this, _1,
-                                                              "Successfully set strategy choice"),
+                                                         std::bind(&Fib::onSetStrategySuccess, this, _1),
                                                          std::bind(&Fib::onSetStrategyFailure, this, _1,
-                                                              parameters,
-                                                              count,
-                                                              "Failed to set strategy choice"));
+                                                                   parameters, count));
 }
 
 void
-Fib::onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
-                         const std::string& message)
+Fib::onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult)
 {
-  NLSR_LOG_DEBUG(message << ": " << commandSuccessResult.getStrategy() <<
+  NLSR_LOG_DEBUG("Successfully set strategy choice: " << commandSuccessResult.getStrategy() <<
                  " for name: " << commandSuccessResult.getName());
 }
 
 void
 Fib::onSetStrategyFailure(const ndn::nfd::ControlResponse& response,
                           const ndn::nfd::ControlParameters& parameters,
-                          uint32_t count,
-                          const std::string& message)
+                          uint32_t count)
 {
-  NLSR_LOG_DEBUG(message << ": " << parameters.getStrategy() <<
+  NLSR_LOG_DEBUG("Failed to set strategy choice: " << parameters.getStrategy() <<
                  " for name: " << parameters.getName());
   if (count < 3) {
     setStrategy(parameters.getName(), parameters.getStrategy().toUri(), count + 1);
@@ -347,9 +341,9 @@
                  " Seq Num: " << entry.getSeqNo() <<
                  " in " << m_refreshTime << " seconds");
 
-  entry.setRefreshEventId(m_scheduler.scheduleEvent(ndn::time::seconds(m_refreshTime),
-                                                    std::bind(&Fib::refreshEntry, this,
-                                                              entry.getName(), refreshCallback)));
+  entry.setRefreshEventId(m_scheduler.schedule(ndn::time::seconds(m_refreshTime),
+                                               std::bind(&Fib::refreshEntry, this,
+                                                         entry.getName(), refreshCallback)));
 }
 
 void
@@ -362,16 +356,13 @@
 Fib::cancelEntryRefresh(const FibEntry& entry)
 {
   NLSR_LOG_DEBUG("Canceling refresh for " << entry.getName() << " Seq Num: " << entry.getSeqNo());
-
-  m_scheduler.cancelEvent(entry.getRefreshEventId());
-  entry.getRefreshEventId().reset();
+  entry.getRefreshEventId().cancel();
 }
 
 void
 Fib::refreshEntry(const ndn::Name& name, afterRefreshCallback refreshCb)
 {
-  std::map<ndn::Name, FibEntry>::iterator it = m_table.find(name);
-
+  auto it = m_table.find(name);
   if (it == m_table.end()) {
     return;
   }
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 012d61d..2d4f47f 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  The University of Memphis,
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -191,16 +191,14 @@
   /*! \brief Log a successful strategy setting.
    */
   void
-  onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
-                       const std::string& message);
+  onSetStrategySuccess(const ndn::nfd::ControlParameters& commandSuccessResult);
 
   /*! \brief Retry a strategy setting up to three (3) times.
    */
   void
   onSetStrategyFailure(const ndn::nfd::ControlResponse& response,
                        const ndn::nfd::ControlParameters& parameters,
-                       uint32_t count,
-                       const std::string& message);
+                       uint32_t count);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   /*! \brief Schedule a refresh event for an entry.
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 4e2fa86..f0e4aac 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California
  *
@@ -160,12 +160,9 @@
 void
 RoutingTable::scheduleRoutingTableCalculation()
 {
-  if (m_isRouteCalculationScheduled != true) {
+  if (!m_isRouteCalculationScheduled) {
     NLSR_LOG_DEBUG("Scheduling routing table calculation in " << m_routingCalcInterval);
-
-    m_scheduler.scheduleEvent(m_routingCalcInterval,
-                              std::bind(&RoutingTable::calculate, this));
-
+    m_scheduler.schedule(m_routingCalcInterval, [this] { calculate(); });
     m_isRouteCalculationScheduled = true;
   }
 }
@@ -182,7 +179,7 @@
   NLSR_LOG_DEBUG("Adding " << nh << " for destination: " << destRouter);
 
   RoutingTableEntry* rteChk = findRoutingTableEntry(destRouter);
-  if (rteChk == 0) {
+  if (rteChk == nullptr) {
     RoutingTableEntry rte(destRouter);
     rte.getNexthopList().addNextHop(nh);
     m_rTable.push_back(rte);
@@ -195,14 +192,12 @@
 RoutingTableEntry*
 RoutingTable::findRoutingTableEntry(const ndn::Name& destRouter)
 {
-  std::list<RoutingTableEntry>::iterator it = std::find_if(m_rTable.begin(),
-                                                           m_rTable.end(),
-                                                           std::bind(&routingTableEntryCompare,
-                                                                     _1, destRouter));
+  auto it = std::find_if(m_rTable.begin(), m_rTable.end(),
+                         std::bind(&routingTableEntryCompare, _1, destRouter));
   if (it != m_rTable.end()) {
     return &(*it);
   }
-  return 0;
+  return nullptr;
 }
 
 void
@@ -230,17 +225,15 @@
 {
   NLSR_LOG_DEBUG("Adding " << nh << " to dry table for destination: " << destRouter);
 
-  std::list<RoutingTableEntry>::iterator it = std::find_if(m_dryTable.begin(),
-                                                           m_dryTable.end(),
-                                                           std::bind(&routingTableEntryCompare,
-                                                                     _1, destRouter));
+  auto it = std::find_if(m_dryTable.begin(), m_dryTable.end(),
+                         std::bind(&routingTableEntryCompare, _1, destRouter));
   if (it == m_dryTable.end()) {
     RoutingTableEntry rte(destRouter);
     rte.getNexthopList().addNextHop(nh);
     m_dryTable.push_back(rte);
   }
   else {
-    (*it).getNexthopList().addNextHop(nh);
+    it->getNexthopList().addNextHop(nh);
   }
 }
 
