diff --git a/src/route/nlsr_fe.cpp b/src/route/nlsr_fe.cpp
index 9464f63..cc724fe 100644
--- a/src/route/nlsr_fe.cpp
+++ b/src/route/nlsr_fe.cpp
@@ -1,6 +1,9 @@
 #include <list>
 #include "nlsr_fe.hpp"
 #include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_fe.cpp"
 
 namespace nlsr
 {
@@ -8,9 +11,9 @@
   using namespace std;
 
   bool
-  FibEntry::isEqualNextHops(Nhl &nhlOther)
+  FibEntry::isEqualNextHops(Nhl& nhlOther)
   {
-    if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
+    if ( m_nhl.getSize() != nhlOther.getSize() )
     {
       return false;
     }
@@ -18,9 +21,9 @@
     {
       int nhCount=0;
       std::list<NextHop>::iterator it1, it2;
-      for ( it1=nhl.getNextHopList().begin(),
+      for ( it1=m_nhl.getNextHopList().begin(),
             it2 = nhlOther.getNextHopList().begin() ;
-            it1 != nhl.getNextHopList().end() ; it1++, it2++)
+            it1 != m_nhl.getNextHopList().end() ; it1++, it2++)
       {
         if (it1->getConnectingFace() == it2->getConnectingFace() )
         {
@@ -32,7 +35,7 @@
           break;
         }
       }
-      return nhCount == nhl.getNhlSize();
+      return nhCount == m_nhl.getSize();
     }
   }
 
diff --git a/src/route/nlsr_fe.hpp b/src/route/nlsr_fe.hpp
index edd77ab..3cac2fc 100644
--- a/src/route/nlsr_fe.hpp
+++ b/src/route/nlsr_fe.hpp
@@ -17,69 +17,69 @@
   {
   public:
     FibEntry()
-      : name()
-      , timeToRefresh(0)
-      , feSeqNo(0)
-      , nhl()
+      : m_name()
+      , m_timeToRefresh(0)
+      , m_seqNo(0)
+      , m_nhl()
     {
     }
 
     FibEntry(string n)
-      : timeToRefresh(0)
-      , feSeqNo(0)
-      , nhl()
+      : m_timeToRefresh(0)
+      , m_seqNo(0)
+      , m_nhl()
     {
-      name=n;
+      m_name=n;
     }
 
     string getName()
     {
-      return name;
+      return m_name;
     }
 
     Nhl& getNhl()
     {
-      return nhl;
+      return m_nhl;
     }
 
     int getTimeToRefresh()
     {
-      return timeToRefresh;
+      return m_timeToRefresh;
     }
 
     void setTimeToRefresh(int ttr)
     {
-      timeToRefresh=ttr;
+      m_timeToRefresh=ttr;
     }
 
-    void setFeExpiringEventId(ndn::EventId feid)
+    void setExpiringEventId(ndn::EventId feid)
     {
-      feExpiringEventId=feid;
+      m_expiringEventId=feid;
     }
 
-    ndn::EventId getFeExpiringEventId()
+    ndn::EventId getExpiringEventId()
     {
-      return feExpiringEventId;
+      return m_expiringEventId;
     }
 
-    void setFeSeqNo(int fsn)
+    void setSeqNo(int fsn)
     {
-      feSeqNo=fsn;
+      m_seqNo=fsn;
     }
 
-    int getFeSeqNo()
+    int getSeqNo()
     {
-      return feSeqNo;
+      return m_seqNo;
     }
 
-    bool isEqualNextHops(Nhl &nhlOther);
+    bool isEqualNextHops(Nhl& nhlOther);
 
   private:
-    string name;
-    int timeToRefresh;
-    ndn::EventId feExpiringEventId;
-    int feSeqNo;
-    Nhl nhl;
+    string m_name;
+    int m_timeToRefresh;
+    ndn::EventId m_expiringEventId;
+    int m_seqNo;
+    Nhl m_nhl;
   };
 
   ostream& operator<<(ostream& os,FibEntry fe);
diff --git a/src/route/nlsr_fib.cpp b/src/route/nlsr_fib.cpp
index 8b03409..141bf3a 100644
--- a/src/route/nlsr_fib.cpp
+++ b/src/route/nlsr_fib.cpp
@@ -3,6 +3,9 @@
 #include "nlsr_fib.hpp"
 #include "nlsr_nhl.hpp"
 #include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_fib.cpp"
 
 namespace nlsr
 {
@@ -17,58 +20,58 @@
   }
 
   void
-  Fib::cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid)
+  Fib::cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid)
   {
     pnlsr.getScheduler().cancelEvent(eid);
   }
 
 
   ndn::EventId
-  Fib::scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
+  Fib::scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
                                   int refreshTime)
   {
     return pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime),
-           ndn::bind(&Fib::refreshFibEntry,this,name,feSeqNum));
+           ndn::bind(&Fib::refreshEntry,this,name,feSeqNum));
   }
 
   void
-  Fib::refreshFibEntry(string name, int feSeqNum)
+  Fib::refreshEntry(string name, int feSeqNum)
   {
   }
 
   void
-  Fib::removeFromFib(Nlsr& pnlsr, string name)
+  Fib::remove(Nlsr& pnlsr, string name)
   {
-    std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
-                                        fibTable.end(), bind(&fibEntryNameCompare, _1, name));
-    if( it != fibTable.end() )
+    std::list<FibEntry >::iterator it = std::find_if( m_table.begin(),
+                                        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++)
       {
         //remove entry from NDN-FIB
       }
-      cancelScheduledFeExpiringEvent(pnlsr, (*it).getFeExpiringEventId());
-      fibTable.erase(it);
+      cancelScheduledExpiringEvent(pnlsr, (*it).getExpiringEventId());
+      m_table.erase(it);
     }
   }
 
 
   void
-  Fib::updateFib(Nlsr& pnlsr,string name, Nhl& nextHopList)
+  Fib::update(Nlsr& pnlsr,string name, Nhl& nextHopList)
   {
     std::cout<<"Fib::updateFib Called"<<std::endl;
     int startFace=0;
     int endFace=getNumberOfFacesForName(nextHopList,
                                         pnlsr.getConfParameter().getMaxFacesPerPrefix());
-    std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
-                                        fibTable.end(),
+    std::list<FibEntry >::iterator it = std::find_if( m_table.begin(),
+                                        m_table.end(),
                                         bind(&fibEntryNameCompare, _1, name));
-    if( it == fibTable.end() )
+    if( it == m_table.end() )
     {
-      if( nextHopList.getNhlSize() > 0 )
+      if( nextHopList.getSize() > 0 )
       {
-        nextHopList.sortNhl();
+        nextHopList.sort();
         FibEntry newEntry(name);
         std::list<NextHop> nhl=nextHopList.getNextHopList();
         std::list<NextHop>::iterator nhit=nhl.begin();
@@ -77,27 +80,27 @@
           newEntry.getNhl().addNextHop((*nhit));
           //Add entry to NDN-FIB
         }
-        newEntry.getNhl().sortNhl();
-        newEntry.setTimeToRefresh(fibEntryRefreshTime);
-        newEntry.setFeSeqNo(1);
-        newEntry.setFeExpiringEventId(scheduleFibEntryRefreshing(pnlsr,
-                                      name ,1,fibEntryRefreshTime));
-        fibTable.push_back(newEntry);
+        newEntry.getNhl().sort();
+        newEntry.setTimeToRefresh(m_refreshTime);
+        newEntry.setSeqNo(1);
+        newEntry.setExpiringEventId(scheduleEntryRefreshing(pnlsr,
+                                      name ,1,m_refreshTime));
+        m_table.push_back(newEntry);
       }
     }
     else
     {
       std::cout<<"Old FIB Entry"<<std::endl;
-      if( nextHopList.getNhlSize() > 0 )
+      if( nextHopList.getSize() > 0 )
       {
-        nextHopList.sortNhl();
+        nextHopList.sort();
         if ( !it->isEqualNextHops(nextHopList) )
         {
           std::list<NextHop> nhl=nextHopList.getNextHopList();
           std::list<NextHop>::iterator nhit=nhl.begin();
           // Add first Entry to NDN-FIB
-          removeFibEntryHop(pnlsr, it->getNhl(),nhit->getConnectingFace());
-          it->getNhl().resetNhl();
+          removeHop(pnlsr, it->getNhl(),nhit->getConnectingFace());
+          it->getNhl().reset();
           it->getNhl().addNextHop((*nhit));
           ++startFace;
           ++nhit;
@@ -107,37 +110,37 @@
             //Add Entry to NDN_FIB
           }
         }
-        it->setTimeToRefresh(fibEntryRefreshTime);
-        cancelScheduledFeExpiringEvent(pnlsr, it->getFeExpiringEventId());
-        it->setFeSeqNo(it->getFeSeqNo()+1);
-        (*it).setFeExpiringEventId(scheduleFibEntryRefreshing(pnlsr,
+        it->setTimeToRefresh(m_refreshTime);
+        cancelScheduledExpiringEvent(pnlsr, it->getExpiringEventId());
+        it->setSeqNo(it->getSeqNo()+1);
+        (*it).setExpiringEventId(scheduleEntryRefreshing(pnlsr,
                                    it->getName() ,
-                                   it->getFeSeqNo(),fibEntryRefreshTime));
+                                   it->getSeqNo(),m_refreshTime));
       }
       else
       {
-        removeFromFib(pnlsr,name);
+        remove(pnlsr,name);
       }
     }
   }
 
 
 
-  void Fib::cleanFib(Nlsr& pnlsr)
+  void Fib::clean(Nlsr& pnlsr)
   {
-    for( std::list<FibEntry >::iterator it=fibTable.begin(); it != fibTable.end();
+    for( std::list<FibEntry >::iterator it=m_table.begin(); it != m_table.end();
          ++it)
     {
       for(std::list<NextHop>::iterator nhit=(*it).getNhl().getNextHopList().begin();
           nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
       {
-        cancelScheduledFeExpiringEvent(pnlsr,(*it).getFeExpiringEventId());
+        cancelScheduledExpiringEvent(pnlsr,(*it).getExpiringEventId());
         //Remove entry from NDN-FIB
       }
     }
-    if ( fibTable.size() > 0 )
+    if ( m_table.size() > 0 )
     {
-      fibTable.clear();
+      m_table.clear();
     }
   }
 
@@ -145,9 +148,9 @@
   Fib::getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix)
   {
     int endFace=0;
-    if((maxFacesPerPrefix == 0) || (nextHopList.getNhlSize() <= maxFacesPerPrefix))
+    if((maxFacesPerPrefix == 0) || (nextHopList.getSize() <= maxFacesPerPrefix))
     {
-      return nextHopList.getNhlSize();
+      return nextHopList.getSize();
     }
     else
     {
@@ -157,7 +160,7 @@
   }
 
   void
-  Fib::removeFibEntryHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId)
+  Fib::removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId)
   {
     for( std::list<NextHop >::iterator it=nl.getNextHopList().begin();
          it != nl.getNextHopList().end();   ++it)
@@ -170,10 +173,10 @@
   }
 
   void
-  Fib::printFib()
+  Fib::print()
   {
     cout<<"-------------------FIB-----------------------------"<<endl;
-    for(std::list<FibEntry>::iterator it = fibTable.begin(); it!=fibTable.end();
+    for(std::list<FibEntry>::iterator it = m_table.begin(); it!=m_table.end();
         ++it)
     {
       cout<<(*it);
diff --git a/src/route/nlsr_fib.hpp b/src/route/nlsr_fib.hpp
index 50369d4..b36d0d8 100644
--- a/src/route/nlsr_fib.hpp
+++ b/src/route/nlsr_fib.hpp
@@ -16,33 +16,33 @@
   {
   public:
     Fib()
-      : fibTable()
-      , fibEntryRefreshTime(0)
+      : m_table()
+      , m_refreshTime(0)
     {
     }
 
-    void removeFromFib(Nlsr& pnlsr, string name);
-    void updateFib(Nlsr& pnlsr, string name, Nhl& nextHopList);
-    void cleanFib(Nlsr& pnlsr);
-    void setFibEntryRefreshTime(int fert)
+    void remove(Nlsr& pnlsr, string name);
+    void update(Nlsr& pnlsr, string name, Nhl& nextHopList);
+    void clean(Nlsr& pnlsr);
+    void setEntryRefreshTime(int fert)
     {
-      fibEntryRefreshTime=fert;
+      m_refreshTime=fert;
     }
 
-    void printFib();
+    void print();
 
   private:
-    void removeFibEntryHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
+    void removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
     int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
     ndn::EventId
-    scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
+    scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
                                int refreshTime);
-    void cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid);
-    void refreshFibEntry(string name, int feSeqNum);
+    void cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
+    void refreshEntry(string name, int feSeqNum);
 
   private:
-    std::list<FibEntry> fibTable;
-    int fibEntryRefreshTime;
+    std::list<FibEntry> m_table;
+    int m_refreshTime;
   };
 
 }//namespace nlsr
diff --git a/src/route/nlsr_map.cpp b/src/route/nlsr_map.cpp
index 19c57c1..f08f1ae 100644
--- a/src/route/nlsr_map.cpp
+++ b/src/route/nlsr_map.cpp
@@ -6,6 +6,9 @@
 #include "nlsr_lsa.hpp"
 #include "nlsr_lsdb.hpp"
 #include "nlsr_map.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_map.cpp"
 
 namespace nlsr
 {
@@ -33,25 +36,25 @@
   }
 
   void
-  Map::addMapElement(string& rtrName)
+  Map::addElement(string& rtrName)
   {
-    MapEntry me(rtrName,mappingIndex);
-    if (  addMapElement(me) )
+    MapEntry me(rtrName,m_mappingIndex);
+    if (  addElement(me) )
     {
-      mappingIndex++;
+      m_mappingIndex++;
     }
   }
 
   bool
-  Map::addMapElement(MapEntry& mpe)
+  Map::addElement(MapEntry& mpe)
   {
     //cout << mpe;
-    std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                        rMap.end(),
+    std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+                                        m_table.end(),
                                         bind(&mapEntryCompareByRouter, _1, mpe.getRouter()));
-    if ( it == rMap.end() )
+    if ( it == m_table.end() )
     {
-      rMap.push_back(mpe);
+      m_table.push_back(mpe);
       return true;
     }
     return false;
@@ -60,10 +63,10 @@
   string
   Map::getRouterNameByMappingNo(int mn)
   {
-    std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                        rMap.end(),
+    std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+                                        m_table.end(),
                                         bind(&mapEntryCompareByMappingNo, _1, mn));
-    if ( it != rMap.end() )
+    if ( it != m_table.end() )
     {
       return (*it).getRouter();
     }
@@ -73,10 +76,10 @@
   int
   Map::getMappingNoByRouterName(string& rName)
   {
-    std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                        rMap.end(),
+    std::list<MapEntry >::iterator it = std::find_if( m_table.begin(),
+                                        m_table.end(),
                                         bind(&mapEntryCompareByRouter, _1, rName));
-    if ( it != rMap.end() )
+    if ( it != m_table.end() )
     {
       return (*it).getMappingNumber();
     }
@@ -84,36 +87,36 @@
   }
 
   void
-  Map::createMapFromAdjLsdb(Nlsr& pnlsr)
+  Map::createFromAdjLsdb(Nlsr& pnlsr)
   {
     std::list<AdjLsa> adjLsdb=pnlsr.getLsdb().getAdjLsdb();
     for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
          it!= adjLsdb.end() ; it++)
     {
       string linkStartRouter=(*it).getOrigRouter();
-      addMapElement(linkStartRouter);
+      addElement(linkStartRouter);
       std::list<Adjacent> adl=(*it).getAdl().getAdjList();
       for( std::list<Adjacent>::iterator itAdl=adl.begin();
            itAdl!= adl.end() ; itAdl++)
       {
-        string linkEndRouter=(*itAdl).getAdjacentName();
-        addMapElement(linkEndRouter);
+        string linkEndRouter=(*itAdl).getName();
+        addElement(linkEndRouter);
       }
     }
   }
 
   void
-  Map::resetMap()
+  Map::reset()
   {
-    rMap.clear();
-    mappingIndex=0;
+    m_table.clear();
+    m_mappingIndex=0;
   }
 
   ostream&
-  operator<<(ostream& os, Map& rMap)
+  operator<<(ostream& os, Map& map)
   {
     os<<"---------------Map----------------------"<<endl;
-    std::list< MapEntry > ml=rMap.getMapList();
+    std::list< MapEntry > ml=map.getMapList();
     for( std::list<MapEntry>::iterator it=ml.begin(); it!= ml.end() ; it++)
     {
       os<< (*it);
diff --git a/src/route/nlsr_map.hpp b/src/route/nlsr_map.hpp
index c362706..bf50aac 100644
--- a/src/route/nlsr_map.hpp
+++ b/src/route/nlsr_map.hpp
@@ -17,8 +17,8 @@
   {
   public:
     MapEntry()
-      : router()
-      , mappingNumber(-1)
+      : m_router()
+      , m_mappingNumber(-1)
     {
     }
 
@@ -28,22 +28,22 @@
 
     MapEntry(string rtr, int mn)
     {
-      router=rtr;
-      mappingNumber=mn;
+      m_router=rtr;
+      m_mappingNumber=mn;
     }
 
     string getRouter()
     {
-      return router;
+      return m_router;
     }
 
     int getMappingNumber()
     {
-      return mappingNumber;
+      return m_mappingNumber;
     }
   private:
-    string router;
-    int mappingNumber;
+    string m_router;
+    int m_mappingNumber;
   };
 
   ostream&
@@ -53,36 +53,36 @@
   {
   public:
     Map()
-      : mappingIndex(0)
+      : m_mappingIndex(0)
     {
     }
 
 
-    void addMapElement(string& rtrName);
-    void createMapFromAdjLsdb(Nlsr& pnlsr);
+    void addElement(string& rtrName);
+    void createFromAdjLsdb(Nlsr& pnlsr);
     string getRouterNameByMappingNo(int mn);
     int getMappingNoByRouterName(string& rName);
-    void resetMap();
+    void reset();
     std::list< MapEntry >& getMapList()
     {
-      return rMap;
+      return m_table;
     }
 
     int getMapSize()
     {
-      return rMap.size();
+      return m_table.size();
     }
 
 
   private:
-    bool addMapElement(MapEntry& mpe);
+    bool addElement(MapEntry& mpe);
 
-    int mappingIndex;
-    std::list< MapEntry > rMap;
+    int m_mappingIndex;
+    std::list< MapEntry > m_table;
   };
 
   ostream&
-  operator<<(ostream& os, Map& rMap);
+  operator<<(ostream& os, Map& map);
 
 } // namespace nlsr
 #endif
diff --git a/src/route/nlsr_nexthop.cpp b/src/route/nlsr_nexthop.cpp
index 1c7257b..08dfe62 100644
--- a/src/route/nlsr_nexthop.cpp
+++ b/src/route/nlsr_nexthop.cpp
@@ -1,4 +1,6 @@
 #include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+#define THIS_FILE "nlsr_nexthop.cpp"
 
 namespace nlsr
 {
diff --git a/src/route/nlsr_nexthop.hpp b/src/route/nlsr_nexthop.hpp
index b8a0af0..0105fb6 100644
--- a/src/route/nlsr_nexthop.hpp
+++ b/src/route/nlsr_nexthop.hpp
@@ -12,39 +12,39 @@
   {
   public:
     NextHop()
-      : connectingFace(0)
-      , routeCost(0)
+      : m_connectingFace(0)
+      , m_routeCost(0)
     {
     }
 
     NextHop(int cf, double rc)
     {
-      connectingFace=cf;
-      routeCost=rc;
+      m_connectingFace=cf;
+      m_routeCost=rc;
     }
 
     int getConnectingFace() const
     {
-      return connectingFace;
+      return m_connectingFace;
     }
 
     void setConnectingFace(int cf)
     {
-      connectingFace=cf;
+      m_connectingFace=cf;
     }
 
     double getRouteCost() const
     {
-      return routeCost;
+      return m_routeCost;
     }
 
     void setRouteCost(double rc)
     {
-      routeCost=rc;
+      m_routeCost=rc;
     }
   private:
-    int connectingFace;
-    double routeCost;
+    int m_connectingFace;
+    double m_routeCost;
   };
 
 
diff --git a/src/route/nlsr_nhl.cpp b/src/route/nlsr_nhl.cpp
index 953a0b6..ed769c9 100644
--- a/src/route/nlsr_nhl.cpp
+++ b/src/route/nlsr_nhl.cpp
@@ -1,8 +1,10 @@
 #include <iostream>
-
+#include "utility/nlsr_logger.hpp"
 #include "nlsr_nhl.hpp"
 #include "nlsr_nexthop.hpp"
 
+#define THIS_FILE "nlsr_nhl.cpp"
+
 namespace nlsr
 {
 
@@ -38,12 +40,12 @@
   void
   Nhl::addNextHop(NextHop& nh)
   {
-    std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
-                                       nexthopList.end(),
+    std::list<NextHop >::iterator it = std::find_if( m_nexthopList.begin(),
+                                       m_nexthopList.end(),
                                        bind(&nexthopCompare, _1, nh));
-    if ( it == nexthopList.end() )
+    if ( it == m_nexthopList.end() )
     {
-      nexthopList.push_back(nh);
+      m_nexthopList.push_back(nh);
     }
     if ( (*it).getRouteCost() > nh.getRouteCost() )
     {
@@ -59,19 +61,19 @@
   void
   Nhl::removeNextHop(NextHop &nh)
   {
-    std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
-                                       nexthopList.end(),
+    std::list<NextHop >::iterator it = std::find_if( m_nexthopList.begin(),
+                                       m_nexthopList.end(),
                                        bind(&nexthopRemoveCompare, _1, nh));
-    if ( it != nexthopList.end() )
+    if ( it != m_nexthopList.end() )
     {
-      nexthopList.erase(it);
+      m_nexthopList.erase(it);
     }
   }
 
   void
-  Nhl::sortNhl()
+  Nhl::sort()
   {
-    nexthopList.sort(nextHopSortingComparator);
+    m_nexthopList.sort(nextHopSortingComparator);
   }
 
   ostream&
diff --git a/src/route/nlsr_nhl.hpp b/src/route/nlsr_nhl.hpp
index f82d37e..fd8b4ca 100644
--- a/src/route/nlsr_nhl.hpp
+++ b/src/route/nlsr_nhl.hpp
@@ -17,7 +17,7 @@
   {
   public:
     Nhl()
-      : nexthopList()
+      : m_nexthopList()
     {
     }
 
@@ -26,25 +26,25 @@
     }
     void addNextHop(NextHop &nh);
     void removeNextHop(NextHop &nh);
-    void sortNhl();
-    int getNhlSize()
+    void sort();
+    int getSize()
     {
-      return nexthopList.size();
+      return m_nexthopList.size();
     }
-    void resetNhl()
+    void reset()
     {
-      if (nexthopList.size() > 0 )
+      if (m_nexthopList.size() > 0 )
       {
-        nexthopList.clear();
+        m_nexthopList.clear();
       }
     }
     std::list< NextHop >& getNextHopList()
     {
-      return nexthopList;
+      return m_nexthopList;
     }
 
   private:
-    std::list< NextHop > nexthopList;
+    std::list< NextHop > m_nexthopList;
   };
 
   ostream&
diff --git a/src/route/nlsr_npt.cpp b/src/route/nlsr_npt.cpp
index 2dfa311..89eba30 100644
--- a/src/route/nlsr_npt.cpp
+++ b/src/route/nlsr_npt.cpp
@@ -1,11 +1,13 @@
 #include <list>
 #include <utility>
 #include <algorithm>
-
+#include "utility/nlsr_logger.hpp"
 #include "nlsr_npt.hpp"
 #include "nlsr_npte.hpp"
 #include "nlsr.hpp"
 
+#define THIS_FILE "nlsr_npt.cpp"
+
 namespace nlsr
 {
 
@@ -22,34 +24,34 @@
   void
   Npt::addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
   {
-    std::list<Npte >::iterator it = std::find_if( npteList.begin(),
-                                    npteList.end(), bind(&npteCompare, _1, name));
-    if ( it == npteList.end() )
+    std::list<Npte >::iterator it = std::find_if( m_npteList.begin(),
+                                    m_npteList.end(), bind(&npteCompare, _1, name));
+    if ( it == m_npteList.end() )
     {
       Npte newEntry(name);
       newEntry.addRoutingTableEntry(rte);
       newEntry.generateNhlfromRteList();
-      newEntry.getNhl().sortNhl();
-      npteList.push_back(newEntry);
-      if(rte.getNhl().getNhlSize()> 0)
+      newEntry.getNhl().sort();
+      m_npteList.push_back(newEntry);
+      if(rte.getNhl().getSize()> 0)
       {
-        pnlsr.getFib().updateFib(pnlsr, name,newEntry.getNhl());
+        pnlsr.getFib().update(pnlsr, name,newEntry.getNhl());
       }
     }
     else
     {
-      if ( rte.getNhl().getNhlSize()> 0 )
+      if ( rte.getNhl().getSize()> 0 )
       {
         (*it).addRoutingTableEntry(rte);
         (*it).generateNhlfromRteList();
-        (*it).getNhl().sortNhl();
-        pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl());
+        (*it).getNhl().sort();
+        pnlsr.getFib().update(pnlsr, name,(*it).getNhl());
       }
       else
       {
         (*it).resetRteListNextHop();
-        (*it).getNhl().resetNhl();
-        pnlsr.getFib().removeFromFib(pnlsr,name);
+        (*it).getNhl().reset();
+        pnlsr.getFib().remove(pnlsr,name);
       }
     }
   }
@@ -57,9 +59,9 @@
   void
   Npt::removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr)
   {
-    std::list<Npte >::iterator it = std::find_if( npteList.begin(),
-                                    npteList.end(), bind(&npteCompare, _1, name));
-    if ( it != npteList.end() )
+    std::list<Npte >::iterator it = std::find_if( m_npteList.begin(),
+                                    m_npteList.end(), bind(&npteCompare, _1, name));
+    if ( it != m_npteList.end() )
     {
       string destRouter=rte.getDestination();
       (*it).removeRoutingTableEntry(rte);
@@ -68,13 +70,13 @@
            (!pnlsr.getLsdb().doesLsaExist(destRouter+"/2",2) ) &&
            (!pnlsr.getLsdb().doesLsaExist(destRouter+"/3",3) )   )
       {
-        npteList.erase(it);
-        pnlsr.getFib().removeFromFib(pnlsr,name);
+        m_npteList.erase(it);
+        pnlsr.getFib().remove(pnlsr,name);
       }
       else
       {
         (*it).generateNhlfromRteList();
-        pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl());
+        pnlsr.getFib().update(pnlsr, name,(*it).getNhl());
       }
     }
   }
@@ -113,9 +115,9 @@
   }
 
   void
-  Npt::updateNptWithNewRoute(Nlsr& pnlsr)
+  Npt::updateWithNewRoute(Nlsr& pnlsr)
   {
-    for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
+    for(std::list<Npte >::iterator it=m_npteList.begin(); it!=m_npteList.end(); ++it)
     {
       std::list<RoutingTableEntry> rteList=(*it).getRteList();
       for(std::list<RoutingTableEntry >::iterator rteit=rteList.begin();
@@ -137,10 +139,10 @@
   }
 
   void
-  Npt::printNpt()
+  Npt::print()
   {
     cout<<"----------------NPT----------------------"<<endl;
-    for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
+    for(std::list<Npte >::iterator it=m_npteList.begin(); it!=m_npteList.end(); ++it)
     {
       cout <<(*it)<<endl;
     }
diff --git a/src/route/nlsr_npt.hpp b/src/route/nlsr_npt.hpp
index 8e6a98c..89af33d 100644
--- a/src/route/nlsr_npt.hpp
+++ b/src/route/nlsr_npt.hpp
@@ -20,13 +20,13 @@
     }
     void addNpteByDestName(string name, string destRouter, Nlsr& pnlsr);
     void removeNpte(string name, string destRouter, Nlsr& pnlsr);
-    void updateNptWithNewRoute(Nlsr& pnlsr);
-    void printNpt();
+    void updateWithNewRoute(Nlsr& pnlsr);
+    void print();
   private:
     void addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
     void removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
   private:
-    std::list<Npte> npteList;
+    std::list<Npte> m_npteList;
   };
 
 }//namespace nlsr
diff --git a/src/route/nlsr_npte.cpp b/src/route/nlsr_npte.cpp
index c342a21..d8e83c3 100644
--- a/src/route/nlsr_npte.cpp
+++ b/src/route/nlsr_npte.cpp
@@ -3,6 +3,9 @@
 #include "nlsr_npte.hpp"
 #include "nlsr_rte.hpp"
 #include "nlsr_nexthop.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_npte.cpp"
 
 namespace nlsr
 {
@@ -12,14 +15,14 @@
   void
   Npte::generateNhlfromRteList()
   {
-    nhl.resetNhl();
-    for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
-         it != rteList.end(); ++it )
+    m_nhl.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)
       {
-        nhl.addNextHop((*nhit));
+        m_nhl.addNextHop((*nhit));
       }
     }
   }
@@ -35,28 +38,28 @@
   void
   Npte::removeRoutingTableEntry(RoutingTableEntry& rte)
   {
-    std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
-        rteList.end(),
+    std::list<RoutingTableEntry >::iterator it = std::find_if( m_rteList.begin(),
+        m_rteList.end(),
         bind(&rteCompare, _1, rte.getDestination()));
-    if ( it != rteList.end() )
+    if ( it != m_rteList.end() )
     {
-      rteList.erase(it);
+      m_rteList.erase(it);
     }
   }
 
   void
   Npte::addRoutingTableEntry(RoutingTableEntry &rte)
   {
-    std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
-        rteList.end(),
+    std::list<RoutingTableEntry >::iterator it = std::find_if( m_rteList.begin(),
+        m_rteList.end(),
         bind(&rteCompare, _1, rte.getDestination()));
-    if ( it == rteList.end() )
+    if ( it == m_rteList.end() )
     {
-      rteList.push_back(rte);
+      m_rteList.push_back(rte);
     }
     else
     {
-      (*it).getNhl().resetNhl(); // reseting existing routing table's next hop
+      (*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)
       {
diff --git a/src/route/nlsr_npte.hpp b/src/route/nlsr_npte.hpp
index 3dfa04a..bb4b1c8 100644
--- a/src/route/nlsr_npte.hpp
+++ b/src/route/nlsr_npte.hpp
@@ -14,55 +14,55 @@
   {
   public:
     Npte()
-      : namePrefix()
-      , nhl()
+      : m_namePrefix()
+      , m_nhl()
     {
     }
     Npte(string np)
-      : nhl()
+      : m_nhl()
     {
-      namePrefix=np;
+      m_namePrefix=np;
     }
 
     string getNamePrefix()
     {
-      return namePrefix;
+      return m_namePrefix;
     }
 
     std::list<RoutingTableEntry>& getRteList()
     {
-      return rteList;
+      return m_rteList;
     }
 
     void resetRteListNextHop()
     {
-      if (rteList.size() > 0 )
+      if (m_rteList.size() > 0 )
       {
-        for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
-             it != rteList.end(); ++it )
+        for( std::list<RoutingTableEntry>::iterator it=m_rteList.begin();
+             it != m_rteList.end(); ++it )
         {
-          (*it).getNhl().resetNhl();
+          (*it).getNhl().reset();
         }
       }
     }
 
     int getRteListSize()
     {
-      return rteList.size();
+      return m_rteList.size();
     }
 
     Nhl& getNhl()
     {
-      return nhl;
+      return m_nhl;
     }
     void generateNhlfromRteList();
     void removeRoutingTableEntry(RoutingTableEntry& rte);
     void addRoutingTableEntry(RoutingTableEntry &rte);
 
   private:
-    string namePrefix;
-    std::list<RoutingTableEntry> rteList;
-    Nhl nhl;
+    string m_namePrefix;
+    std::list<RoutingTableEntry> m_rteList;
+    Nhl m_nhl;
   };
 
   ostream&
diff --git a/src/route/nlsr_rt.cpp b/src/route/nlsr_rt.cpp
index 2cd9b28..8267930 100644
--- a/src/route/nlsr_rt.cpp
+++ b/src/route/nlsr_rt.cpp
@@ -8,6 +8,9 @@
 #include "nlsr_rtc.hpp"
 #include "nlsr_rte.hpp"
 #include "nlsr_npt.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rt.cpp"
 
 namespace nlsr
 {
@@ -19,7 +22,7 @@
   {
     //debugging purpose
     std::cout<<pnlsr.getConfParameter()<<std::endl;
-    pnlsr.getNpt().printNpt();
+    pnlsr.getNpt().print();
     pnlsr.getLsdb().printAdjLsdb();
     pnlsr.getLsdb().printCorLsdb();
     pnlsr.getLsdb().printNameLsdb();
@@ -51,11 +54,11 @@
             calculateHypDryRoutingTable(pnlsr);
           }
           //need to update NPT here
-          pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
+          pnlsr.getNpt().updateWithNewRoute(pnlsr);
           //debugging purpose
           printRoutingTable();
-          pnlsr.getNpt().printNpt();
-          pnlsr.getFib().printFib();
+          pnlsr.getNpt().print();
+          pnlsr.getFib().print();
           //debugging purpose end
         }
         else
@@ -72,11 +75,11 @@
         clearDryRoutingTable(); // for dry run options
         // need to update NPT here
         std::cout<<"Calling Update NPT With new Route"<<std::endl;
-        pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
+        pnlsr.getNpt().updateWithNewRoute(pnlsr);
         //debugging purpose
         printRoutingTable();
-        pnlsr.getNpt().printNpt();
-        pnlsr.getFib().printFib();
+        pnlsr.getNpt().print();
+        pnlsr.getFib().print();
         //debugging purpose end
       }
       pnlsr.setIsRouteCalculationScheduled(0); //clear scheduled flag
@@ -94,7 +97,7 @@
   {
     cout<<"RoutingTable::calculateLsRoutingTable Called"<<endl;
     Map vMap;
-    vMap.createMapFromAdjLsdb(pnlsr);
+    vMap.createFromAdjLsdb(pnlsr);
     int numOfRouter=vMap.getMapSize();
     LinkStateRoutingTableCalculator lsrtc(numOfRouter);
     lsrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -104,7 +107,7 @@
   RoutingTable::calculateHypRoutingTable(Nlsr& pnlsr)
   {
     Map vMap;
-    vMap.createMapFromAdjLsdb(pnlsr);
+    vMap.createFromAdjLsdb(pnlsr);
     int numOfRouter=vMap.getMapSize();
     HypRoutingTableCalculator hrtc(numOfRouter,0);
     hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -114,7 +117,7 @@
   RoutingTable::calculateHypDryRoutingTable(Nlsr& pnlsr)
   {
     Map vMap;
-    vMap.createMapFromAdjLsdb(pnlsr);
+    vMap.createFromAdjLsdb(pnlsr);
     int numOfRouter=vMap.getMapSize();
     HypRoutingTableCalculator hrtc(numOfRouter,1);
     hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
@@ -146,7 +149,7 @@
     {
       RoutingTableEntry rte(destRouter);
       rte.getNhl().addNextHop(nh);
-      rTable.push_back(rte);
+      m_rTable.push_back(rte);
     }
     else
     {
@@ -157,10 +160,10 @@
   std::pair<RoutingTableEntry&, bool>
   RoutingTable::findRoutingTableEntry(string destRouter)
   {
-    std::list<RoutingTableEntry >::iterator it = std::find_if( rTable.begin(),
-        rTable.end(),
+    std::list<RoutingTableEntry >::iterator it = std::find_if( m_rTable.begin(),
+        m_rTable.end(),
         bind(&routingTableEntryCompare, _1, destRouter));
-    if ( it != rTable.end() )
+    if ( it != m_rTable.end() )
     {
       return std::make_pair(boost::ref((*it)),true);
     }
@@ -172,8 +175,8 @@
   RoutingTable::printRoutingTable()
   {
     cout<<"---------------Routing Table------------------"<<endl;
-    for(std::list<RoutingTableEntry>::iterator it=rTable.begin() ;
-        it != rTable.end(); ++it)
+    for(std::list<RoutingTableEntry>::iterator it=m_rTable.begin() ;
+        it != m_rTable.end(); ++it)
     {
       cout<<(*it)<<endl;
     }
@@ -184,14 +187,14 @@
   void
   RoutingTable::addNextHopToDryTable(string destRouter, NextHop& nh)
   {
-    std::list<RoutingTableEntry >::iterator it = std::find_if( dryTable.begin(),
-        dryTable.end(),
+    std::list<RoutingTableEntry >::iterator it = std::find_if( m_dryTable.begin(),
+        m_dryTable.end(),
         bind(&routingTableEntryCompare, _1, destRouter));
-    if ( it == dryTable.end() )
+    if ( it == m_dryTable.end() )
     {
       RoutingTableEntry rte(destRouter);
       rte.getNhl().addNextHop(nh);
-      dryTable.push_back(rte);
+      m_dryTable.push_back(rte);
     }
     else
     {
@@ -203,8 +206,8 @@
   RoutingTable::printDryRoutingTable()
   {
     cout<<"--------Dry Run's Routing Table--------------"<<endl;
-    for(std::list<RoutingTableEntry>::iterator it=dryTable.begin() ;
-        it != dryTable.end(); ++it)
+    for(std::list<RoutingTableEntry>::iterator it=m_dryTable.begin() ;
+        it != m_dryTable.end(); ++it)
     {
       cout<<(*it)<<endl;
     }
@@ -214,18 +217,18 @@
   void
   RoutingTable::clearRoutingTable()
   {
-    if( rTable.size() > 0 )
+    if( m_rTable.size() > 0 )
     {
-      rTable.clear();
+      m_rTable.clear();
     }
   }
 
   void
   RoutingTable::clearDryRoutingTable()
   {
-    if (dryTable.size()>0 )
+    if (m_dryTable.size()>0 )
     {
-      dryTable.clear();
+      m_dryTable.clear();
     }
   }
 
diff --git a/src/route/nlsr_rt.hpp b/src/route/nlsr_rt.hpp
index bf4e489..e382b8b 100644
--- a/src/route/nlsr_rt.hpp
+++ b/src/route/nlsr_rt.hpp
@@ -34,15 +34,15 @@
   private:
     void calculateLsRoutingTable(Nlsr& pnlsr);
     void calculateHypRoutingTable(Nlsr& pnlsr);
-    void calculateHypDryRoutingTable(Nlsr&pnlsr);
+    void calculateHypDryRoutingTable(Nlsr& pnlsr);
 
     void clearRoutingTable();
     void clearDryRoutingTable();
 
     const int NO_NEXT_HOP;
 
-    std::list< RoutingTableEntry > rTable;
-    std::list< RoutingTableEntry > dryTable;
+    std::list< RoutingTableEntry > m_rTable;
+    std::list< RoutingTableEntry > m_dryTable;
   };
 
 }//namespace nlsr
diff --git a/src/route/nlsr_rtc.cpp b/src/route/nlsr_rtc.cpp
index 90200e5..c6499f7 100644
--- a/src/route/nlsr_rtc.cpp
+++ b/src/route/nlsr_rtc.cpp
@@ -6,6 +6,9 @@
 #include "nlsr_lsa.hpp"
 #include "nlsr_nexthop.hpp"
 #include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rtc.cpp"
 
 namespace nlsr
 {
@@ -45,7 +48,7 @@
       for( std::list<Adjacent>::iterator itAdl=adl.begin();
            itAdl!= adl.end() ; itAdl++)
       {
-        string linkEndRouter=(*itAdl).getAdjacentName();
+        string linkEndRouter=(*itAdl).getName();
         int col=pMap.getMappingNoByRouterName(linkEndRouter);
         double cost=(*itAdl).getLinkCost();
         if ( (row >= 0 && row<numOfRouter) && (col >= 0 && col<numOfRouter) )
@@ -206,18 +209,18 @@
     /* Initiate the Parent */
     for (i = 0 ; i < numOfRouter; i++)
     {
-      parent[i]=EMPTY_PARENT;
-      distance[i]=INF_DISTANCE;
+      m_parent[i]=EMPTY_PARENT;
+      m_distance[i]=INF_DISTANCE;
       Q[i]=i;
     }
     if ( sourceRouter != NO_MAPPING_NUM )
     {
-      distance[sourceRouter]=0;
-      sortQueueByDistance(Q,distance,head,numOfRouter);
+      m_distance[sourceRouter]=0;
+      sortQueueByDistance(Q,m_distance,head,numOfRouter);
       while (head < numOfRouter )
       {
         u=Q[head];
-        if(distance[u] == INF_DISTANCE)
+        if(m_distance[u] == INF_DISTANCE)
         {
           break;
         }
@@ -227,16 +230,16 @@
           {
             if ( isNotExplored(Q,v,head+1,numOfRouter) )
             {
-              if( distance[u] + adjMatrix[u][v] <  distance[v])
+              if( m_distance[u] + adjMatrix[u][v] <  m_distance[v])
               {
-                distance[v]=distance[u] + adjMatrix[u][v] ;
-                parent[v]=u;
+                m_distance[v]=m_distance[u] + adjMatrix[u][v] ;
+                m_parent[v]=u;
               }
             }
           }
         }
         head++;
-        sortQueueByDistance(Q,distance,head,numOfRouter);
+        sortQueueByDistance(Q,m_distance,head,numOfRouter);
       }
     }
     delete [] Q;
@@ -255,7 +258,7 @@
         int nextHopRouter=getLsNextHop(i,sourceRouter);
         if ( nextHopRouter != NO_NEXT_HOP )
         {
-          double routeCost=distance[i];
+          double routeCost=m_distance[i];
           string nextHopRouterName=
             pMap.getRouterNameByMappingNo(nextHopRouter);
           int nxtHopFace=
@@ -277,10 +280,10 @@
   LinkStateRoutingTableCalculator::getLsNextHop(int dest, int source)
   {
     int nextHop;
-    while ( parent[dest] != EMPTY_PARENT )
+    while ( m_parent[dest] != EMPTY_PARENT )
     {
       nextHop=dest;
-      dest=parent[dest];
+      dest=m_parent[dest];
     }
     if ( dest != source )
     {
@@ -307,9 +310,9 @@
   void
   LinkStateRoutingTableCalculator::printLsPath(int destRouter)
   {
-    if (parent[destRouter] != EMPTY_PARENT )
+    if (m_parent[destRouter] != EMPTY_PARENT )
     {
-      printLsPath(parent[destRouter]);
+      printLsPath(m_parent[destRouter]);
     }
     cout<<" "<<destRouter;
   }
@@ -351,24 +354,24 @@
   void
   LinkStateRoutingTableCalculator::allocateParent()
   {
-    parent=new int[numOfRouter];
+    m_parent=new int[numOfRouter];
   }
 
   void
   LinkStateRoutingTableCalculator::allocateDistance()
   {
-    distance= new double[numOfRouter];
+    m_distance= new double[numOfRouter];
   }
 
   void
   LinkStateRoutingTableCalculator::freeParent()
   {
-    delete [] parent;
+    delete [] m_parent;
   }
 
   void LinkStateRoutingTableCalculator::freeDistance()
   {
-    delete [] distance;
+    delete [] m_distance;
   }
 
 
@@ -404,9 +407,9 @@
                                    pMap,links[j],i);
           if ( distToDestFromNbr >= 0 )
           {
-            linkFaces[k] = nextHopFace;
-            distanceToNeighbor[k] = distToNbr;
-            distFromNbrToDest[k] = distToDestFromNbr;
+            m_linkFaces[k] = nextHopFace;
+            m_distanceToNeighbor[k] = distToNbr;
+            m_distFromNbrToDest[k] = distToDestFromNbr;
             k++;
           }
         }
@@ -428,9 +431,9 @@
     for(int i=0 ; i < noFaces ; ++i)
     {
       string destRouter=pMap.getRouterNameByMappingNo(dest);
-      NextHop nh(linkFaces[i],distFromNbrToDest[i]);
+      NextHop nh(m_linkFaces[i],m_distFromNbrToDest[i]);
       rt.addNextHop(destRouter,nh);
-      if( isDryRun == 1 )
+      if( m_isDryRun)
       {
         rt.addNextHopToDryTable(destRouter,nh);
       }
@@ -472,37 +475,37 @@
   void
   HypRoutingTableCalculator::allocateLinkFaces()
   {
-    linkFaces=new int[vNoLink];
+    m_linkFaces=new int[vNoLink];
   }
 
   void
   HypRoutingTableCalculator::allocateDistanceToNeighbor()
   {
-    distanceToNeighbor=new double[vNoLink];
+    m_distanceToNeighbor=new double[vNoLink];
   }
 
   void
   HypRoutingTableCalculator::allocateDistFromNbrToDest()
   {
-    distFromNbrToDest=new double[vNoLink];
+    m_distFromNbrToDest=new double[vNoLink];
   }
 
   void
   HypRoutingTableCalculator::freeLinkFaces()
   {
-    delete [] linkFaces;
+    delete [] m_linkFaces;
   }
 
   void
   HypRoutingTableCalculator::freeDistanceToNeighbor()
   {
-    delete [] distanceToNeighbor;
+    delete [] m_distanceToNeighbor;
   }
 
   void
   HypRoutingTableCalculator::freeDistFromNbrToDest()
   {
-    delete [] distFromNbrToDest;
+    delete [] m_distFromNbrToDest;
   }
 
 }//namespace nlsr
diff --git a/src/route/nlsr_rtc.hpp b/src/route/nlsr_rtc.hpp
index 730612c..dba45ca 100644
--- a/src/route/nlsr_rtc.hpp
+++ b/src/route/nlsr_rtc.hpp
@@ -45,12 +45,12 @@
     }
 
   protected:
-    double ** adjMatrix;
+    double** adjMatrix;
     int numOfRouter;
 
     int vNoLink;
-    int *links;
-    double *linkCosts;
+    int* links;
+    double* linkCosts;
   };
 
   class LinkStateRoutingTableCalculator: public RoutingTableCalculator
@@ -71,8 +71,8 @@
 
   private:
     void doDijkstraPathCalculation(int sourceRouter);
-    void sortQueueByDistance(int *Q, double *dist,int start,int element);
-    int isNotExplored(int *Q, int u,int start, int element);
+    void sortQueueByDistance(int* Q, double* dist,int start,int element);
+    int isNotExplored(int* Q, int u,int start, int element);
     void printAllLsPath(int sourceRouter);
     void printLsPath(int destRouter);
     void addAllLsNextHopsToRoutingTable(Nlsr& pnlsr, RoutingTable& rt,
@@ -88,8 +88,8 @@
 
 
   private:
-    int *parent;
-    double *distance;
+    int* m_parent;
+    double* m_distance;
 
 
     const int EMPTY_PARENT;
@@ -106,13 +106,13 @@
       :  MATH_PI(3.141592654)
     {
       numOfRouter=rn;
-      isDryRun=0;
+      m_isDryRun=0;
     }
     HypRoutingTableCalculator(int rn, int idr)
       :  MATH_PI(3.141592654)
     {
       numOfRouter=rn;
-      isDryRun=idr;
+      m_isDryRun=idr;
     }
 
     void calculatePath(Map& pMap, RoutingTable& rt, Nlsr& pnlsr);
@@ -130,11 +130,11 @@
                                       RoutingTable& rt, int noFaces,int dest);
 
   private:
-    int isDryRun;
+    bool m_isDryRun;
 
-    int *linkFaces;
-    double *distanceToNeighbor;
-    double *distFromNbrToDest;
+    int* m_linkFaces;
+    double* m_distanceToNeighbor;
+    double* m_distFromNbrToDest;
 
     const double MATH_PI;
 
diff --git a/src/route/nlsr_rte.cpp b/src/route/nlsr_rte.cpp
index 129ab8a..7c06b03 100644
--- a/src/route/nlsr_rte.cpp
+++ b/src/route/nlsr_rte.cpp
@@ -2,6 +2,9 @@
 #include <string>
 
 #include "nlsr_rte.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_rte.cpp"
 
 namespace nlsr
 {
@@ -9,7 +12,7 @@
   using namespace std;
 
   ostream&
-  operator<<(ostream& os, RoutingTableEntry &rte)
+  operator<<(ostream& os, RoutingTableEntry& rte)
   {
     os<<"Destination: "<<rte.getDestination()<<endl;
     os<<"Nexthops: "<<endl;
diff --git a/src/route/nlsr_rte.hpp b/src/route/nlsr_rte.hpp
index 736909b..484edab 100644
--- a/src/route/nlsr_rte.hpp
+++ b/src/route/nlsr_rte.hpp
@@ -14,8 +14,8 @@
   {
   public:
     RoutingTableEntry()
-      : destination()
-      , nhl()
+      : m_destination()
+      , m_nhl()
     {
     }
 
@@ -24,28 +24,28 @@
     }
 
     RoutingTableEntry(string dest)
-      : nhl()
+      : m_nhl()
     {
-      destination=dest;
+      m_destination=dest;
     }
 
     string getDestination()
     {
-      return destination;
+      return m_destination;
     }
 
     Nhl& getNhl()
     {
-      return nhl;
+      return m_nhl;
     }
 
   private:
-    string destination;
-    Nhl nhl;
+    string m_destination;
+    Nhl m_nhl;
   };
 
   ostream&
-  operator<<(ostream& os, RoutingTableEntry &rte);
+  operator<<(ostream& os, RoutingTableEntry& rte);
 
 }
 
