diff --git a/src/route/fib-entry.cpp b/src/route/fib-entry.cpp
index 05bee41..524b04c 100644
--- a/src/route/fib-entry.cpp
+++ b/src/route/fib-entry.cpp
@@ -9,17 +9,17 @@
 bool
 FibEntry::isEqualNextHops(NexthopList& nhlOther)
 {
-  if (m_nhl.getSize() != nhlOther.getSize())
+  if (m_nexthopList.getSize() != nhlOther.getSize())
   {
     return false;
   }
   else
   {
-    int nhCount = 0;
+    uint32_t nhCount = 0;
     std::list<NextHop>::iterator it1, it2;
-    for (it1 = m_nhl.getNextHopList().begin(),
-         it2 = nhlOther.getNextHopList().begin() ;
-         it1 != m_nhl.getNextHopList().end() ; it1++, it2++)
+    for (it1 = m_nexthopList.getNextHops().begin(),
+         it2 = nhlOther.getNextHops().begin() ;
+         it1 != m_nexthopList.getNextHops().end() ; it1++, it2++)
     {
       if (it1->getConnectingFace() == it2->getConnectingFace())
       {
@@ -31,7 +31,7 @@
         break;
       }
     }
-    return nhCount == m_nhl.getSize();
+    return nhCount == m_nexthopList.getSize();
   }
 }
 
@@ -40,7 +40,7 @@
 {
   os << "Name Prefix: " << fe.getName() << endl;
   os << "Time to Refresh: " << fe.getTimeToRefresh() << endl;
-  os << fe.getNhl() << endl;
+  os << fe.getNexthopList() << endl;
   return os;
 }
 
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index d320c9a..88de53e 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -1,8 +1,10 @@
-#ifndef NLSR_FE_HPP
-#define NLSR_FE_HPP
+#ifndef NLSR_FIB_ENTRY_HPP
+#define NLSR_FIB_ENTRY_HPP
 
 #include <list>
 #include <iostream>
+#include <boost/cstdint.hpp>
+
 #include <ndn-cxx/util/scheduler.hpp>
 
 #include "nexthop.hpp"
@@ -10,8 +12,6 @@
 
 namespace nlsr {
 
-using namespace std;
-
 class FibEntry
 {
 public:
@@ -19,38 +19,38 @@
     : m_name()
     , m_timeToRefresh(0)
     , m_seqNo(0)
-    , m_nhl()
+    , m_nexthopList()
   {
   }
 
-  FibEntry(string n)
+  FibEntry(const std::string& name)
     : m_timeToRefresh(0)
     , m_seqNo(0)
-    , m_nhl()
+    , m_nexthopList()
   {
-    m_name = n;
+    m_name = name;
   }
 
-  std::string
+  const std::string&
   getName() const
   {
     return m_name;
   }
 
   NexthopList&
-  getNhl()
+  getNexthopList()
   {
-    return m_nhl;
+    return m_nexthopList;
   }
 
-  int
+  int32_t
   getTimeToRefresh() const
   {
     return m_timeToRefresh;
   }
 
   void
-  setTimeToRefresh(int ttr)
+  setTimeToRefresh(int32_t ttr)
   {
     m_timeToRefresh = ttr;
   }
@@ -68,12 +68,12 @@
   }
 
   void
-  setSeqNo(int fsn)
+  setSeqNo(int32_t fsn)
   {
     m_seqNo = fsn;
   }
 
-  int
+  int32_t
   getSeqNo()
   {
     return m_seqNo;
@@ -84,10 +84,10 @@
 
 private:
   std::string m_name;
-  int m_timeToRefresh;
+  int32_t m_timeToRefresh;
   ndn::EventId m_expiringEventId;
-  int m_seqNo;
-  NexthopList m_nhl;
+  int32_t m_seqNo;
+  NexthopList m_nexthopList;
 };
 
 std::ostream&
@@ -95,4 +95,4 @@
 
 } //namespace nlsr
 
-#endif //NLSR_FE_HPP
+#endif //NLSR_FIB_ENTRY_HPP
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 1d7582b..1272ab1 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,9 +1,10 @@
 #include <list>
+#include <cmath>
 
 #include "nlsr.hpp"
-#include "fib-entry.hpp"
-#include "fib.hpp"
 #include "nexthop-list.hpp"
+#include "fib.hpp"
+
 
 
 
@@ -13,9 +14,9 @@
 using namespace ndn;
 
 static bool
-fibEntryNameCompare(FibEntry& fe, string name)
+fibEntryNameCompare(const FibEntry& fibEntry, const string& name)
 {
-  return fe.getName() == name ;
+  return fibEntry.getName() == name ;
 }
 
 void
@@ -26,32 +27,78 @@
 
 
 ndn::EventId
-Fib::scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
-                             int refreshTime)
+Fib::scheduleEntryRefreshing(Nlsr& pnlsr, const string& name, int32_t feSeqNum,
+                             int32_t refreshTime)
 {
+  std::cout << "Fib::scheduleEntryRefreshing Called" << std::endl;
+  std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl;
   return pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime),
-                                            ndn::bind(&Fib::refreshEntry, this, name, feSeqNum));
+                                            ndn::bind(&Fib::refreshEntry, this,
+                                                      boost::ref(pnlsr), 
+                                                      name, feSeqNum));
 }
 
 void
-Fib::refreshEntry(string name, int feSeqNum)
+Fib::refreshEntry(Nlsr& nlsr, const string& name, int32_t feSeqNum)
 {
+  std::cout << "Fib::refreshEntry Called" << std::endl;
+  std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl;
+  std::list<FibEntry>::iterator it = std::find_if(m_table.begin(),
+                                                  m_table.end(),
+                                                  bind(&fibEntryNameCompare, _1, name));
+  if (it != m_table.end())
+  {
+    std::cout << "Entry found with Seq Num: " << feSeqNum << std::endl;
+    if (it->getSeqNo() == feSeqNum)
+    {
+      std::cout << "Refreshing the FIB entry" << std::endl;
+      for (std::list<NextHop>::iterator nhit =
+           (*it).getNexthopList().getNextHops().begin();
+         nhit != (*it).getNexthopList().getNextHops().end(); nhit++)
+      {
+        // add entry to NDN-FIB
+        registerPrefixInNfd(it->getName(), nhit->getConnectingFace(), std::ceil(nhit->getRouteCost()));
+      }
+      
+      // increase sequence number and schedule refresh again
+      it->setSeqNo(feSeqNum + 1);
+      it->setExpiringEventId(scheduleEntryRefreshing(nlsr,
+                                                     it->getName() ,
+                                                     it->getSeqNo(), 
+                                                     m_refreshTime));
+      
+    }
+  }
 }
 
 void
-Fib::remove(Nlsr& pnlsr, string name)
+Fib::remove(Nlsr& pnlsr, const std::string& name)
 {
   std::list<FibEntry>::iterator it = std::find_if(m_table.begin(),
-                                                  m_table.end(), 
+                                                  m_table.end(),
                                                   bind(&fibEntryNameCompare, _1, name));
   if (it != m_table.end())
   {
     for (std::list<NextHop>::iterator nhit =
-           (*it).getNhl().getNextHopList().begin();
-         nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
+           (*it).getNexthopList().getNextHops().begin();
+         nhit != (*it).getNexthopList().getNextHops().end(); nhit++)
     {
       //remove entry from NDN-FIB
+      if (!pnlsr.getAdjacencyList().isNeighbor(it->getName()))
+      {
+        unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace());
+      }
+      else
+      {
+        if(pnlsr.getAdjacencyList().getAdjacent(it->getName()).getConnectingFace() != 
+           nhit->getConnectingFace())
+        {
+          unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace());
+        }
+      }
     }
+    std::cout << "Cancellling Scheduled event" << std::endl;
+    std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
     cancelScheduledExpiringEvent(pnlsr, (*it).getExpiringEventId());
     m_table.erase(it);
   }
@@ -59,7 +106,7 @@
 
 
 void
-Fib::update(Nlsr& pnlsr, string name, NexthopList& nextHopList)
+Fib::update(Nlsr& pnlsr, const string& name, NexthopList& nextHopList)
 {
   std::cout << "Fib::updateFib Called" << std::endl;
   int startFace = 0;
@@ -74,14 +121,15 @@
     {
       nextHopList.sort();
       FibEntry newEntry(name);
-      std::list<NextHop> nhl = nextHopList.getNextHopList();
+      std::list<NextHop> nhl = nextHopList.getNextHops();
       std::list<NextHop>::iterator nhit = nhl.begin();
       for (int i = startFace; i < endFace && nhit != nhl.end(); ++nhit, i++)
       {
-        newEntry.getNhl().addNextHop((*nhit));
+        newEntry.getNexthopList().addNextHop((*nhit));
         //Add entry to NDN-FIB
+        registerPrefixInNfd(name, nhit->getConnectingFace(), std::ceil(nhit->getRouteCost()));
       }
-      newEntry.getNhl().sort();
+      newEntry.getNexthopList().sort();
       newEntry.setTimeToRefresh(m_refreshTime);
       newEntry.setSeqNo(1);
       newEntry.setExpiringEventId(scheduleEntryRefreshing(pnlsr,
@@ -97,21 +145,25 @@
       nextHopList.sort();
       if (!it->isEqualNextHops(nextHopList))
       {
-        std::list<NextHop> nhl = nextHopList.getNextHopList();
+        std::list<NextHop> nhl = nextHopList.getNextHops();
         std::list<NextHop>::iterator nhit = nhl.begin();
         // Add first Entry to NDN-FIB
-        removeHop(pnlsr, it->getNhl(), nhit->getConnectingFace());
-        it->getNhl().reset();
-        it->getNhl().addNextHop((*nhit));
+        registerPrefixInNfd(name, nhit->getConnectingFace(), std::ceil(nhit->getRouteCost()));
+        removeHop(pnlsr, it->getNexthopList(), nhit->getConnectingFace(), name);
+        it->getNexthopList().reset();
+        it->getNexthopList().addNextHop((*nhit));
         ++startFace;
         ++nhit;
         for (int i = startFace; i < endFace && nhit != nhl.end(); ++nhit, i++)
         {
-          it->getNhl().addNextHop((*nhit));
+          it->getNexthopList().addNextHop((*nhit));
           //Add Entry to NDN_FIB
+          registerPrefixInNfd(name, nhit->getConnectingFace(), std::ceil(nhit->getRouteCost()));
         }
       }
       it->setTimeToRefresh(m_refreshTime);
+      std::cout << "Cancellling Scheduled event" << std::endl;
+      std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
       cancelScheduledExpiringEvent(pnlsr, it->getExpiringEventId());
       it->setSeqNo(it->getSeqNo() + 1);
       (*it).setExpiringEventId(scheduleEntryRefreshing(pnlsr,
@@ -133,12 +185,26 @@
   for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end();
        ++it)
   {
+    std::cout << "Cancellling Scheduled event" << std::endl;
+    std::cout << "Name: " << it->getName() << "Seq num: " << it->getSeqNo() << std::endl;
+    cancelScheduledExpiringEvent(pnlsr, (*it).getExpiringEventId());
     for (std::list<NextHop>::iterator nhit =
-           (*it).getNhl().getNextHopList().begin();
-         nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
+           (*it).getNexthopList().getNextHops().begin();
+         nhit != (*it).getNexthopList().getNextHops().end(); nhit++)
     {
-      cancelScheduledExpiringEvent(pnlsr, (*it).getExpiringEventId());
       //Remove entry from NDN-FIB
+      if (!pnlsr.getAdjacencyList().isNeighbor(it->getName()))
+      {
+        unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace());
+      }
+      else
+      {
+        if(pnlsr.getAdjacencyList().getAdjacent(it->getName()).getConnectingFace() != 
+           nhit->getConnectingFace())
+        {
+          unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace());
+        }
+      }
     }
   }
   if (m_table.size() > 0)
@@ -148,7 +214,7 @@
 }
 
 int
-Fib::getNumberOfFacesForName(NexthopList& nextHopList, int maxFacesPerPrefix)
+Fib::getNumberOfFacesForName(NexthopList& nextHopList, uint32_t maxFacesPerPrefix)
 {
   int endFace = 0;
   if ((maxFacesPerPrefix == 0) || (nextHopList.getSize() <= maxFacesPerPrefix))
@@ -163,19 +229,79 @@
 }
 
 void
-Fib::removeHop(Nlsr& pnlsr, NexthopList& nl, int doNotRemoveHopFaceId)
+Fib::removeHop(Nlsr& pnlsr, NexthopList& nl, uint32_t doNotRemoveHopFaceId,
+               const std::string& name)
 {
-  for (std::list<NextHop>::iterator it = nl.getNextHopList().begin();
-       it != nl.getNextHopList().end();   ++it)
+  for (std::list<NextHop>::iterator it = nl.getNextHops().begin();
+       it != nl.getNextHops().end();   ++it)
   {
     if (it->getConnectingFace() != doNotRemoveHopFaceId)
     {
       //Remove FIB Entry from NDN-FIB
+      if (!pnlsr.getAdjacencyList().isNeighbor(name))
+      {
+        unregisterPrefixFromNfd(name, it->getConnectingFace());
+      }
+      else
+      {
+        if(pnlsr.getAdjacencyList().getAdjacent(name).getConnectingFace() != 
+           it->getConnectingFace())
+        {
+          unregisterPrefixFromNfd(name, it->getConnectingFace());
+        }
+      }
     }
   }
 }
 
 void
+Fib::registerPrefixInNfd(const std::string& namePrefix, uint64_t faceId, uint64_t faceCost)
+{
+  ndn::nfd::ControlParameters controlParameters;
+  controlParameters
+    .setName(namePrefix)
+    .setCost(faceCost)
+    .setFaceId(faceId)
+    .setExpirationPeriod(ndn::time::milliseconds(m_refreshTime*1000))
+    .setOrigin(128);
+
+  m_controller.start<ndn::nfd::RibRegisterCommand>(controlParameters,
+                                                   ndn::bind(&Fib::onSuccess, this, _1,
+                                                             "Successful in name registration"),
+                                                   ndn::bind(&Fib::onFailure, this, _1, _2,
+                                                             "Failed in name registration"));
+}
+  
+void
+Fib::unregisterPrefixFromNfd(const std::string& namePrefix, uint64_t faceId)
+{
+  ndn::nfd::ControlParameters controlParameters;
+  controlParameters
+    .setName(namePrefix)
+    .setFaceId(faceId)
+    .setOrigin(128);
+
+  m_controller.start<ndn::nfd::RibUnregisterCommand>(controlParameters,
+                                                     ndn::bind(&Fib::onSuccess, this, _1,
+                                                               "Successful in unregistering name"),
+                                                     ndn::bind(&Fib::onFailure, this, _1, _2,
+                                                               "Failed in unregistering name"));
+}
+
+void
+Fib::onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult, const std::string& message)
+{
+  std::cout << message << ": " << commandSuccessResult << std::endl;
+}
+
+void
+Fib::onFailure(uint32_t code, const std::string& error, const std::string& message)
+{
+  std::cout << message << ": " << error << " (code: " << code << ")";
+}
+
+
+void
 Fib::print()
 {
   cout << "-------------------FIB-----------------------------" << endl;
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 4a80c48..2a90fc1 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -2,35 +2,41 @@
 #define NLSR_FIB_HPP
 
 #include <list>
+#include <boost/cstdint.hpp>
+
+#include <ndn-cxx/management/nfd-controller.hpp>
+
 #include "fib-entry.hpp"
 
 namespace nlsr {
 
 class Nlsr;
 
-using namespace std;
-using namespace ndn;
 
 class Fib
 {
 public:
-  Fib()
+  Fib(ndn::Face& face)
     : m_table()
     , m_refreshTime(0)
+    , m_controller(face)
+  {
+  }
+  ~Fib()
   {
   }
 
   void
-  remove(Nlsr& pnlsr, string name);
+  remove(Nlsr& pnlsr, const std::string& name);
 
   void
-  update(Nlsr& pnlsr, string name, NexthopList& nextHopList);
+  update(Nlsr& pnlsr, const std::string& name, NexthopList& nextHopList);
 
   void
   clean(Nlsr& pnlsr);
 
   void
-  setEntryRefreshTime(int fert)
+  setEntryRefreshTime(int32_t fert)
   {
     m_refreshTime = fert;
   }
@@ -40,23 +46,38 @@
 
 private:
   void
-  removeHop(Nlsr& pnlsr, NexthopList& nl, int doNotRemoveHopFaceId);
+  removeHop(Nlsr& pnlsr, NexthopList& nl, uint32_t doNotRemoveHopFaceId,
+            const std::string& name);
 
   int
-  getNumberOfFacesForName(NexthopList& nextHopList, int maxFacesPerPrefix);
+  getNumberOfFacesForName(NexthopList& nextHopList, uint32_t maxFacesPerPrefix);
 
   ndn::EventId
-  scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
-                          int refreshTime);
-  void
-  cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
+  scheduleEntryRefreshing(Nlsr& pnlsr, const std::string& name, int32_t feSeqNum,
+                          int32_t refreshTime);
 
   void
-  refreshEntry(string name, int feSeqNum);
+  cancelScheduledExpiringEvent(Nlsr& pnlsr, ndn::EventId eid);
+
+  void
+  refreshEntry(Nlsr& nlsr, const std::string& name, int32_t feSeqNum);
+
+  void
+  registerPrefixInNfd(const std::string& namePrefix, uint64_t faceId, uint64_t faceCost);
+
+  void
+  unregisterPrefixFromNfd(const std::string& namePrefix, uint64_t faceId);
+  
+  void
+  onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult, const std::string& message);
+
+  void
+  onFailure(uint32_t code, const std::string& error, const std::string& message);
 
 private:
   std::list<FibEntry> m_table;
-  int m_refreshTime;
+  int32_t m_refreshTime;
+  ndn::nfd::Controller m_controller;
 };
 
 }//namespace nlsr
diff --git a/src/route/map-entry.hpp b/src/route/map-entry.hpp
new file mode 100644
index 0000000..9174345
--- /dev/null
+++ b/src/route/map-entry.hpp
@@ -0,0 +1,54 @@
+#ifndef NLSR_MAP_ENTRY_HPP
+#define NLSR_MAP_ENTRY_HPP
+
+#include <boost/cstdint.hpp>
+
+namespace nlsr{
+
+class MapEntry
+{
+public:
+  MapEntry()
+    : m_router()
+    , m_mappingNumber(-1)
+  {
+  }
+
+  ~MapEntry()
+  {
+  }
+
+  MapEntry(const std::string& rtr, int32_t mn)
+  {
+    m_router = rtr;
+    m_mappingNumber = mn;
+  }
+
+  const std::string&
+  getRouter() const
+  {
+    return m_router;
+  }
+
+  int32_t
+  getMappingNumber() const
+  {
+    return m_mappingNumber;
+  }
+
+private:
+  std::string m_router;
+  int32_t m_mappingNumber;
+};
+
+inline std::ostream&
+operator<<(std::ostream& os, const MapEntry& mpe)
+{
+  os << "MapEntry: ( Router: " << mpe.getRouter() << " Mapping No: ";
+  os << mpe.getMappingNumber() << " )" << std::endl;
+  return os;
+}
+
+} // namespace nlsr
+
+#endif // NLSR_MAP_ENTRY_HPP
diff --git a/src/route/map.cpp b/src/route/map.cpp
index e7ab979..4701a05 100644
--- a/src/route/map.cpp
+++ b/src/route/map.cpp
@@ -11,38 +11,30 @@
 
 using namespace std;
 
-ostream&
-operator<< (ostream& os, MapEntry& mpe)
-{
-  os << "MapEntry: ( Router: " << mpe.getRouter() << " Mapping No: ";
-  os << mpe.getMappingNumber() << " )" << endl;
-  return os;
-}
-
 static bool
-mapEntryCompareByRouter(MapEntry& mpe1, string& rtrName)
+mapEntryCompareByRouter(MapEntry& mpe1, const string& rtrName)
 {
   return mpe1.getRouter() == rtrName;
 }
 
 static bool
-mapEntryCompareByMappingNo(MapEntry& mpe1, int mappingNo)
+mapEntryCompareByMappingNo(MapEntry& mpe1, int32_t mappingNo)
 {
   return mpe1.getMappingNumber() == mappingNo;
 }
 
 void
-Map::addElement(string& rtrName)
+Map::addEntry(const string& rtrName)
 {
   MapEntry me(rtrName, m_mappingIndex);
-  if (addElement(me))
+  if (addEntry(me))
   {
     m_mappingIndex++;
   }
 }
 
 bool
-Map::addElement(MapEntry& mpe)
+Map::addEntry(MapEntry& mpe)
 {
   //cout << mpe;
   std::list<MapEntry>::iterator it = std::find_if(m_table.begin(),
@@ -57,7 +49,7 @@
 }
 
 string
-Map::getRouterNameByMappingNo(int mn)
+Map::getRouterNameByMappingNo(int32_t mn)
 {
   std::list<MapEntry>::iterator it = std::find_if(m_table.begin(),
                                                   m_table.end(),
@@ -70,7 +62,7 @@
   return "";
 }
 
-int
+int32_t
 Map::getMappingNoByRouterName(string& rName)
 {
   std::list<MapEntry>::iterator it = std::find_if(m_table.begin(),
@@ -92,13 +84,13 @@
        it != adjLsdb.end() ; it++)
   {
     string linkStartRouter = (*it).getOrigRouter();
-    addElement(linkStartRouter);
+    addEntry(linkStartRouter);
     std::list<Adjacent> adl = (*it).getAdl().getAdjList();
     for (std::list<Adjacent>::iterator itAdl = adl.begin();
          itAdl != adl.end() ; itAdl++)
     {
       string linkEndRouter = (*itAdl).getName();
-      addElement(linkEndRouter);
+      addEntry(linkEndRouter);
     }
   }
 }
diff --git a/src/route/map.hpp b/src/route/map.hpp
index bdacd4d..cc08771 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -3,52 +3,16 @@
 
 #include <iostream>
 #include <list>
+#include <boost/cstdint.hpp>
 
-#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/common.hpp>
+
+#include "map-entry.hpp"
 
 namespace nlsr {
 
 class Nlsr;
 
-class MapEntry
-{
-public:
-  MapEntry()
-    : m_router()
-    , m_mappingNumber(-1)
-  {
-  }
-
-  ~MapEntry()
-  {
-  }
-
-  MapEntry(std::string rtr, int mn)
-  {
-    m_router = rtr;
-    m_mappingNumber = mn;
-  }
-
-  std::string
-  getRouter() const
-  {
-    return m_router;
-  }
-
-  int
-  getMappingNumber() const
-  {
-    return m_mappingNumber;
-  }
-
-private:
-  std::string m_router;
-  int m_mappingNumber;
-};
-
-std::ostream&
-operator<<(std::ostream& os, MapEntry& mpe);
-
 class Map
 {
 public:
@@ -59,15 +23,15 @@
 
 
   void
-  addElement(std::string& rtrName);
+  addEntry(const std::string& rtrName);
 
   void
   createFromAdjLsdb(Nlsr& pnlsr);
 
   std::string
-  getRouterNameByMappingNo(int mn);
+  getRouterNameByMappingNo(int32_t mn);
 
-  int
+  int32_t
   getMappingNoByRouterName(std::string& rName);
 
   void
@@ -88,9 +52,9 @@
 
 private:
   bool
-  addElement(MapEntry& mpe);
+  addEntry(MapEntry& mpe);
 
-  int m_mappingIndex;
+  int32_t m_mappingIndex;
   std::list<MapEntry> m_table;
 };
 
diff --git a/src/route/name-prefix-table-entry.cpp b/src/route/name-prefix-table-entry.cpp
index 4389373..01eea0d 100644
--- a/src/route/name-prefix-table-entry.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -11,15 +11,15 @@
 void
 NamePrefixTableEntry::generateNhlfromRteList()
 {
-  m_nhl.reset();
+  m_nexthopList.reset();
   for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
        it != m_rteList.end(); ++it)
   {
     for (std::list<NextHop>::iterator nhit =
-           (*it).getNhl().getNextHopList().begin();
-         nhit != (*it).getNhl().getNextHopList().end(); ++nhit)
+           (*it).getNexthopList().getNextHops().begin();
+         nhit != (*it).getNexthopList().getNextHops().end(); ++nhit)
     {
-      m_nhl.addNextHop((*nhit));
+      m_nexthopList.addNextHop((*nhit));
     }
   }
 }
@@ -56,11 +56,11 @@
   }
   else
   {
-    (*it).getNhl().reset(); // reseting existing routing table's next hop
-    for (std::list<NextHop>::iterator nhit = rte.getNhl().getNextHopList().begin();
-         nhit != rte.getNhl().getNextHopList().end(); ++nhit)
+    (*it).getNexthopList().reset(); // reseting existing routing table's next hop
+    for (std::list<NextHop>::iterator nhit = rte.getNexthopList().getNextHops().begin();
+         nhit != rte.getNexthopList().getNextHops().end(); ++nhit)
     {
-      (*it).getNhl().addNextHop((*nhit));
+      (*it).getNexthopList().addNextHop((*nhit));
     }
   }
 }
@@ -76,7 +76,7 @@
   {
     cout << (*it);
   }
-  os << npte.getNhl();
+  os << npte.getNexthopList();
   return os;
 }
 
diff --git a/src/route/name-prefix-table-entry.hpp b/src/route/name-prefix-table-entry.hpp
index 7f4f83a..0ee28fa 100644
--- a/src/route/name-prefix-table-entry.hpp
+++ b/src/route/name-prefix-table-entry.hpp
@@ -1,31 +1,29 @@
-#ifndef NLSR_NPTE_HPP
-#define NLSR_NPTE_HPP
+#ifndef NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
+#define NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
 
 #include <list>
 #include <utility>
+#include <boost/cstdint.hpp>
+
 #include "routing-table-entry.hpp"
 
 namespace nlsr {
 
-using namespace std;
-
 class NamePrefixTableEntry
 {
 public:
   NamePrefixTableEntry()
-    : m_namePrefix()
-    , m_nhl()
   {
   }
 
-  NamePrefixTableEntry(string np)
-    : m_nhl()
+  NamePrefixTableEntry(const std::string& namePrefix)
+    : m_nexthopList()
   {
-    m_namePrefix = np;
+    m_namePrefix = namePrefix;
   }
 
-  std::string
-  getNamePrefix()
+  const std::string&
+  getNamePrefix() const
   {
     return m_namePrefix;
   }
@@ -44,21 +42,21 @@
       for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
            it != m_rteList.end(); ++it)
       {
-        (*it).getNhl().reset();
+        (*it).getNexthopList().reset();
       }
     }
   }
 
-  int
+  size_t
   getRteListSize()
   {
     return m_rteList.size();
   }
 
   NexthopList&
-  getNhl()
+  getNexthopList()
   {
-    return m_nhl;
+    return m_nexthopList;
   }
 
   void
@@ -73,7 +71,7 @@
 private:
   std::string m_namePrefix;
   std::list<RoutingTableEntry> m_rteList;
-  NexthopList m_nhl;
+  NexthopList m_nexthopList;
 };
 
 std::ostream&
@@ -81,4 +79,4 @@
 
 }//namespace nlsr
 
-#endif //NLSR_NPTE_HPP
+#endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index e37751b..e6a7ccf 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -13,7 +13,7 @@
 using namespace std;
 
 static bool
-npteCompare(NamePrefixTableEntry& npte, string& name)
+npteCompare(NamePrefixTableEntry& npte, const string& name)
 {
   return npte.getNamePrefix() == name;
 }
@@ -21,46 +21,46 @@
 
 
 void
-NamePrefixTable::addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::addEntry(const string& name, RoutingTableEntry& rte, Nlsr& pnlsr)
 {
-  std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_npteList.begin(),
-                                                              m_npteList.end(), bind(&npteCompare, _1, name));
-  if (it == m_npteList.end())
+  std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
+                                                              m_table.end(), bind(&npteCompare, _1, name));
+  if (it == m_table.end())
   {
     NamePrefixTableEntry newEntry(name);
     newEntry.addRoutingTableEntry(rte);
     newEntry.generateNhlfromRteList();
-    newEntry.getNhl().sort();
-    m_npteList.push_back(newEntry);
-    if (rte.getNhl().getSize() > 0)
+    newEntry.getNexthopList().sort();
+    m_table.push_back(newEntry);
+    if (rte.getNexthopList().getSize() > 0)
     {
-      pnlsr.getFib().update(pnlsr, name, newEntry.getNhl());
+      pnlsr.getFib().update(pnlsr, name, newEntry.getNexthopList());
     }
   }
   else
   {
-    if (rte.getNhl().getSize() > 0)
+    if (rte.getNexthopList().getSize() > 0)
     {
       (*it).addRoutingTableEntry(rte);
       (*it).generateNhlfromRteList();
-      (*it).getNhl().sort();
-      pnlsr.getFib().update(pnlsr, name, (*it).getNhl());
+      (*it).getNexthopList().sort();
+      pnlsr.getFib().update(pnlsr, name, (*it).getNexthopList());
     }
     else
     {
       (*it).resetRteListNextHop();
-      (*it).getNhl().reset();
+      (*it).getNexthopList().reset();
       pnlsr.getFib().remove(pnlsr, name);
     }
   }
 }
 
 void
-NamePrefixTable::removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
+NamePrefixTable::removeEntry(const string& name, RoutingTableEntry& rte, Nlsr& pnlsr)
 {
-  std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_npteList.begin(),
-                                                              m_npteList.end(), bind(&npteCompare, _1, name));
-  if (it != m_npteList.end())
+  std::list<NamePrefixTableEntry>::iterator it = std::find_if(m_table.begin(),
+                                                              m_table.end(), bind(&npteCompare, _1, name));
+  if (it != m_table.end())
   {
     string destRouter = rte.getDestination();
     (*it).removeRoutingTableEntry(rte);
@@ -69,56 +69,55 @@
         (!pnlsr.getLsdb().doesLsaExist(destRouter + "/2", 2)) &&
         (!pnlsr.getLsdb().doesLsaExist(destRouter + "/3", 3)))
     {
-      m_npteList.erase(it);
+      m_table.erase(it);
       pnlsr.getFib().remove(pnlsr, name);
     }
     else
     {
       (*it).generateNhlfromRteList();
-      pnlsr.getFib().update(pnlsr, name, (*it).getNhl());
+      pnlsr.getFib().update(pnlsr, name, (*it).getNexthopList());
     }
   }
 }
 
 
 void
-NamePrefixTable::addNpteByDestName(string name, string destRouter, Nlsr& pnlsr)
+NamePrefixTable::addEntry(const string& name, const string& destRouter, Nlsr& pnlsr)
 {
   RoutingTableEntry* rteCheck =
     pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
   if (rteCheck != 0)
   {
-    addNpte(name, *(rteCheck) , pnlsr);
+    addEntry(name, *(rteCheck) , pnlsr);
   }
   else
   {
     RoutingTableEntry rte(destRouter);
-    addNpte(name, rte, pnlsr);
+    addEntry(name, rte, pnlsr);
   }
 }
 
 void
-NamePrefixTable::removeNpte(string name, string destRouter, Nlsr& pnlsr)
+NamePrefixTable::removeEntry(const string& name, const string& destRouter, Nlsr& pnlsr)
 {
   RoutingTableEntry* rteCheck =
     pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
   if (rteCheck != 0)
   {
-    removeNpte(name, *(rteCheck), pnlsr);
+    removeEntry(name, *(rteCheck), pnlsr);
   }
   else
   {
     RoutingTableEntry rte(destRouter);
-    removeNpte(name, rte, pnlsr);
+    removeEntry(name, rte, pnlsr);
   }
 }
 
 void
 NamePrefixTable::updateWithNewRoute(Nlsr& pnlsr)
 {
-  for (std::list<NamePrefixTableEntry>::iterator it = m_npteList.begin();
-       it != m_npteList.end();
-       ++it)
+  for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
+       it != m_table.end(); ++it)
   {
     std::list<RoutingTableEntry> rteList = (*it).getRteList();
     for (std::list<RoutingTableEntry>::iterator rteit = rteList.begin();
@@ -128,12 +127,12 @@
         pnlsr.getRoutingTable().findRoutingTableEntry((*rteit).getDestination());
       if (rteCheck != 0)
       {
-        addNpte((*it).getNamePrefix(), *(rteCheck), pnlsr);
+        addEntry((*it).getNamePrefix(), *(rteCheck), pnlsr);
       }
       else
       {
         RoutingTableEntry rte((*rteit).getDestination());
-        addNpte((*it).getNamePrefix(), rte, pnlsr);
+        addEntry((*it).getNamePrefix(), rte, pnlsr);
       }
     }
   }
@@ -143,8 +142,8 @@
 NamePrefixTable::print()
 {
   std::cout << "----------------NPT----------------------" << std::endl;
-  for (std::list<NamePrefixTableEntry>::iterator it = m_npteList.begin();
-       it != m_npteList.end();
+  for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
+       it != m_table.end();
        ++it)
   {
     cout << (*it) << endl;
diff --git a/src/route/name-prefix-table.hpp b/src/route/name-prefix-table.hpp
index 1a59af2..4f7fbb4 100644
--- a/src/route/name-prefix-table.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -1,7 +1,9 @@
-#ifndef NLSR_NPT_HPP
-#define NLSR_NPT_HPP
+#ifndef NLSR_NAME_PREFIX_TABLE_HPP
+#define NLSR_NAME_PREFIX_TABLE_HPP
 
 #include <list>
+#include <boost/cstdint.hpp>
+
 #include "name-prefix-table-entry.hpp"
 #include "routing-table-entry.hpp"
 
@@ -14,11 +16,12 @@
   NamePrefixTable()
   {
   }
-  void
-  addNpteByDestName(std::string name, std::string destRouter, Nlsr& pnlsr);
 
   void
-  removeNpte(std::string name, std::string destRouter, Nlsr& pnlsr);
+  addEntry(const std::string& name, const std::string& destRouter, Nlsr& pnlsr);
+
+  void
+  removeEntry(const std::string& name, const std::string& destRouter, Nlsr& pnlsr);
 
   void
   updateWithNewRoute(Nlsr& pnlsr);
@@ -28,15 +31,15 @@
 
 private:
   void
-  addNpte(std::string name, RoutingTableEntry& rte, Nlsr& pnlsr);
+  addEntry(const std::string& name, RoutingTableEntry& rte, Nlsr& pnlsr);
 
   void
-  removeNpte(std::string name, RoutingTableEntry& rte, Nlsr& pnlsr);
+  removeEntry(const std::string& name, RoutingTableEntry& rte, Nlsr& pnlsr);
 
 private:
-  std::list<NamePrefixTableEntry> m_npteList;
+  std::list<NamePrefixTableEntry> m_table;
 };
 
 }//namespace nlsr
 
-#endif //NLSR_NPT_HPP
+#endif //NLSR_NAME_PREFIX_TABLE_HPP
diff --git a/src/route/nexthop-list.cpp b/src/route/nexthop-list.cpp
index 7edb96e..5468b40 100644
--- a/src/route/nexthop-list.cpp
+++ b/src/route/nexthop-list.cpp
@@ -75,7 +75,7 @@
 ostream&
 operator<<(ostream& os, NexthopList& nhl)
 {
-  std::list<NextHop> nexthopList = nhl.getNextHopList();
+  std::list<NextHop> nexthopList = nhl.getNextHops();
   int i = 1;
   for (std::list<NextHop>::iterator it = nexthopList.begin();
        it != nexthopList.end() ; it++, i++)
diff --git a/src/route/nexthop-list.hpp b/src/route/nexthop-list.hpp
index a8ebe7b..2607218 100644
--- a/src/route/nexthop-list.hpp
+++ b/src/route/nexthop-list.hpp
@@ -1,9 +1,11 @@
-#ifndef NLSR_NHL_HPP
-#define NLSR_NHL_HPP
+#ifndef NLSR_NEXTHOP_LIST_HPP
+#define NLSR_NEXTHOP_LIST_HPP
 
-#include <ndn-cxx/face.hpp>
 #include <list>
 #include <iostream>
+#include <boost/cstdint.hpp>
+
+#include <ndn-cxx/face.hpp>
 
 #include "nexthop.hpp"
 #include "adjacent.hpp"
@@ -14,13 +16,13 @@
 {
 public:
   NexthopList()
-    : m_nexthopList()
   {
   }
 
   ~NexthopList()
   {
   }
+
   void
   addNextHop(NextHop& nh);
 
@@ -30,7 +32,7 @@
   void
   sort();
 
-  int
+  size_t
   getSize()
   {
     return m_nexthopList.size();
@@ -39,14 +41,11 @@
   void
   reset()
   {
-    if (m_nexthopList.size() > 0)
-    {
-      m_nexthopList.clear();
-    }
+    m_nexthopList.clear();
   }
 
   std::list<NextHop>&
-  getNextHopList()
+  getNextHops()
   {
     return m_nexthopList;
   }
@@ -60,4 +59,4 @@
 
 }//namespace nlsr
 
-#endif //NLSR_NLH_HPP
+#endif //NLSR_NEXTHOP_LIST_HPP
diff --git a/src/route/nexthop.hpp b/src/route/nexthop.hpp
index 7153e0f..ed8d319 100644
--- a/src/route/nexthop.hpp
+++ b/src/route/nexthop.hpp
@@ -2,6 +2,7 @@
 #define NLSR_NEXTHOP_HPP
 
 #include <iostream>
+#include <boost/cstdint.hpp>
 
 namespace nlsr {
 class NextHop
@@ -13,20 +14,20 @@
   {
   }
 
-  NextHop(int cf, double rc)
+  NextHop(uint32_t cf, double rc)
   {
     m_connectingFace = cf;
     m_routeCost = rc;
   }
 
-  int
+  uint32_t
   getConnectingFace() const
   {
     return m_connectingFace;
   }
 
   void
-  setConnectingFace(int cf)
+  setConnectingFace(uint32_t cf)
   {
     m_connectingFace = cf;
   }
@@ -44,7 +45,7 @@
   }
 
 private:
-  int m_connectingFace;
+  uint32_t m_connectingFace;
   double m_routeCost;
 };
 
diff --git a/src/route/routing-table-calculator.hpp b/src/route/routing-table-calculator.hpp
index b248b15..544896c 100644
--- a/src/route/routing-table-calculator.hpp
+++ b/src/route/routing-table-calculator.hpp
@@ -1,8 +1,9 @@
-#ifndef NLSR_RTC_HPP
-#define NLSR_RTC_HPP
+#ifndef NLSR_ROUTING_TABLE_CALCULATOR_HPP
+#define NLSR_ROUTING_TABLE_CALCULATOR_HPP
 
 #include <list>
 #include <iostream>
+#include <boost/cstdint.hpp>
 
 namespace nlsr {
 
@@ -198,4 +199,4 @@
 
 }//namespace nlsr
 
-#endif //NLSR_RTC_HPP
+#endif //NLSR_ROUTING_TABLE_CALCULATOR_HPP
diff --git a/src/route/routing-table-entry.cpp b/src/route/routing-table-entry.cpp
deleted file mode 100644
index 5222cb9..0000000
--- a/src/route/routing-table-entry.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <iostream>
-#include <string>
-
-#include "routing-table-entry.hpp"
-
-namespace nlsr {
-
-using namespace std;
-
-ostream&
-operator<<(ostream& os, RoutingTableEntry& rte)
-{
-  os << "Destination: " << rte.getDestination() << endl;
-  os << "Nexthops: " << endl;
-  int i = 1;
-  std::list<NextHop> nhl = rte.getNhl().getNextHopList();
-  for (std::list<NextHop>::iterator it = nhl.begin();
-       it != nhl.end() ; it++, i++)
-  {
-    os << "  Nexthop " << i << ": " << (*it) << endl;
-  }
-  return os;
-}
-
-}//namespace nlsr
diff --git a/src/route/routing-table-entry.hpp b/src/route/routing-table-entry.hpp
index 8877275..0d0b662 100644
--- a/src/route/routing-table-entry.hpp
+++ b/src/route/routing-table-entry.hpp
@@ -1,5 +1,5 @@
-#ifndef NLSR_RTE_HPP
-#define NLSR_RTE_HPP
+#ifndef NLSR_ROUTING_TABLE_ENTRY_HPP
+#define NLSR_ROUTING_TABLE_ENTRY_HPP
 
 #include <iostream>
 
@@ -11,8 +11,6 @@
 {
 public:
   RoutingTableEntry()
-    : m_destination()
-    , m_nhl()
   {
   }
 
@@ -20,8 +18,7 @@
   {
   }
 
-  RoutingTableEntry(std::string dest)
-    : m_nhl()
+  RoutingTableEntry(const std::string& dest)
   {
     m_destination = dest;
   }
@@ -33,19 +30,31 @@
   }
 
   NexthopList&
-  getNhl()
+  getNexthopList()
   {
-    return m_nhl;
+    return m_nexthopList;
   }
 
 private:
   std::string m_destination;
-  NexthopList m_nhl;
+  NexthopList m_nexthopList;
 };
 
-std::ostream&
-operator<<(std::ostream& os, RoutingTableEntry& rte);
+inline std::ostream&
+operator<<(std::ostream& os, RoutingTableEntry& rte)
+{
+  os << "Destination: " << rte.getDestination() << std::endl;
+  os << "Nexthops: " << std::endl;
+  int32_t i = 1;
+  std::list<NextHop> nhl = rte.getNexthopList().getNextHops();
+  for (std::list<NextHop>::iterator it = nhl.begin();
+       it != nhl.end() ; it++, i++)
+  {
+    os << "  Nexthop " << i << ": " << (*it) << std::endl;
+  }
+  return os;
+}
 
 } //namespace nlsr
 
-#endif //NLSR_RTE_HPP
+#endif //NLSR_ROUTING_TABLE_ENTRY_HPP
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 2bc827c..bb7d3fa 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -144,12 +144,12 @@
   if (rteChk == 0)
   {
     RoutingTableEntry rte(destRouter);
-    rte.getNhl().addNextHop(nh);
+    rte.getNexthopList().addNextHop(nh);
     m_rTable.push_back(rte);
   }
   else
   {
-    rteChk->getNhl().addNextHop(nh);
+    rteChk->getNexthopList().addNextHop(nh);
   }
 }
 
@@ -188,12 +188,12 @@
   if (it == m_dryTable.end())
   {
     RoutingTableEntry rte(destRouter);
-    rte.getNhl().addNextHop(nh);
+    rte.getNexthopList().addNextHop(nh);
     m_dryTable.push_back(rte);
   }
   else
   {
-    (*it).getNhl().addNextHop(nh);
+    (*it).getNexthopList().addNextHop(nh);
   }
 }
 
diff --git a/src/route/routing-table.hpp b/src/route/routing-table.hpp
index 8518b12..35f563e 100644
--- a/src/route/routing-table.hpp
+++ b/src/route/routing-table.hpp
@@ -1,9 +1,10 @@
-#ifndef NLSR_RT_HPP
-#define NLSR_RT_HPP
+#ifndef NLSR_ROUTING_TABLE_HPP
+#define NLSR_ROUTING_TABLE_HPP
 
 #include <iostream>
 #include <utility>
 #include <string>
+#include <boost/cstdint.hpp>
 
 #include "routing-table-entry.hpp"
 
@@ -70,4 +71,4 @@
 
 }//namespace nlsr
 
-#endif //NLSR_RT_HPP
+#endif //NLSR_ROUTING_TABLE_HPP
