diff --git a/src/communication/nlsr_dm.cpp b/src/communication/nlsr_dm.cpp
index ffb85e3..249b5e7 100644
--- a/src/communication/nlsr_dm.cpp
+++ b/src/communication/nlsr_dm.cpp
@@ -10,6 +10,9 @@
 #include "utility/nlsr_tokenizer.hpp"
 #include "nlsr_lsdb.hpp"
 #include "security/nlsr_km.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_dm.cpp"
 
 namespace nlsr
 {
@@ -19,7 +22,7 @@
 
   void
   DataManager::processContent(Nlsr& pnlsr, const ndn::Interest &interest,
-                              const ndn::Data & data, interestManager& im)
+                              const ndn::Data & data, InterestManager& im)
   {
     cout << "I: " << interest.toUri() << endl;
     string dataName(data.getName().toUri());
@@ -141,7 +144,7 @@
     if ( pnlsr.getLsdb().isNameLsaNew(lsaKey,lsSeqNo))
     {
       NameLsa nameLsa;
-      if( nameLsa.initNameLsaFromContent(dataContent) )
+      if( nameLsa.initializeFromContent(dataContent) )
       {
         pnlsr.getLsdb().installNameLsa(pnlsr, nameLsa);
       }
@@ -159,7 +162,7 @@
     if ( pnlsr.getLsdb().isAdjLsaNew(lsaKey,lsSeqNo))
     {
       AdjLsa adjLsa;
-      if( adjLsa.initAdjLsaFromContent(dataContent) )
+      if( adjLsa.initializeFromContent(dataContent) )
       {
         pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
       }
@@ -177,7 +180,7 @@
     if ( pnlsr.getLsdb().isCorLsaNew(lsaKey,lsSeqNo))
     {
       CorLsa corLsa;
-      if( corLsa.initCorLsaFromContent(dataContent) )
+      if( corLsa.initializeFromContent(dataContent) )
       {
         pnlsr.getLsdb().installCorLsa(pnlsr, corLsa);
       }
diff --git a/src/communication/nlsr_dm.hpp b/src/communication/nlsr_dm.hpp
index 4a807f2..fc231d3 100644
--- a/src/communication/nlsr_dm.hpp
+++ b/src/communication/nlsr_dm.hpp
@@ -18,8 +18,8 @@
   class DataManager
   {
   public:
-    void processContent(Nlsr& pnlsr, const ndn::Interest &interest,
-                        const ndn::Data& data, interestManager& im);
+    void processContent(Nlsr& pnlsr, const ndn::Interest& interest,
+                        const ndn::Data& data, InterestManager& im);
   private:
     void processContentInfo(Nlsr& pnlsr, string& dataName,
                             string& dataContent);
diff --git a/src/communication/nlsr_im.cpp b/src/communication/nlsr_im.cpp
index 16d0c72..d708812 100644
--- a/src/communication/nlsr_im.cpp
+++ b/src/communication/nlsr_im.cpp
@@ -10,6 +10,9 @@
 #include "nlsr_dm.hpp"
 #include "utility/nlsr_tokenizer.hpp"
 #include "nlsr_lsdb.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_im.cpp"
 
 namespace nlsr
 {
@@ -18,9 +21,9 @@
   using namespace ndn;
 
   void
-  interestManager::processInterest( Nlsr& pnlsr,
-                                    const ndn::Name &name,
-                                    const ndn::Interest &interest)
+  InterestManager::processInterest( Nlsr& pnlsr,
+                                    const ndn::Name& name,
+                                    const ndn::Interest& interest)
   {
     cout << "<< I: " << interest << endl;
     string intName=interest.getName().toUri();
@@ -46,13 +49,13 @@
   }
 
   void
-  interestManager::processInterestInfo(Nlsr& pnlsr, string& neighbor,
-                                       const ndn::Interest &interest)
+  InterestManager::processInterestInfo(Nlsr& pnlsr, string& neighbor,
+                                       const ndn::Interest& interest)
   {
     if ( pnlsr.getAdl().isNeighbor(neighbor) )
     {
       Data data(ndn::Name(interest.getName()).appendVersion());
-      data.setFreshnessPeriod(1000); // 10 sec
+      data.setFreshnessPeriod(time::seconds(10)); // 10 sec
       data.setContent((const uint8_t*)"info", sizeof("info"));
       pnlsr.getKeyManager().signData(data);
       cout << ">> D: " << data << endl;
@@ -69,7 +72,7 @@
   }
 
   void
-  interestManager::processInterestLsa(Nlsr& pnlsr,const ndn::Interest &interest)
+  InterestManager::processInterestLsa(Nlsr& pnlsr,const ndn::Interest& interest)
   {
     string intName=interest.getName().toUri();
     nlsrTokenizer nt(intName,"/");
@@ -115,8 +118,8 @@
   }
 
   void
-  interestManager::processInterestForNameLsa(Nlsr& pnlsr,
-      const ndn::Interest &interest,
+  InterestManager::processInterestForNameLsa(Nlsr& pnlsr,
+      const ndn::Interest& interest,
       string lsaKey, uint32_t interestedlsSeqNo)
   {
     std::pair<NameLsa&, bool>  nameLsa=pnlsr.getLsdb().getNameLsa(lsaKey);
@@ -125,8 +128,8 @@
       if ( nameLsa.first.getLsSeqNo() >= interestedlsSeqNo )
       {
         Data data(ndn::Name(interest.getName()).appendVersion());
-        data.setFreshnessPeriod(1000); // 10 sec
-        string content=nameLsa.first.getNameLsaData();
+        data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+        string content=nameLsa.first.getData();
         data.setContent((const uint8_t*)content.c_str(),content.size());
         pnlsr.getKeyManager().signData(data);
         cout << ">> D: " << data << endl;
@@ -136,8 +139,8 @@
   }
 
   void
-  interestManager::processInterestForAdjLsa(Nlsr& pnlsr,
-      const ndn::Interest &interest,
+  InterestManager::processInterestForAdjLsa(Nlsr& pnlsr,
+      const ndn::Interest& interest,
       string lsaKey, uint32_t interestedlsSeqNo)
   {
     std::pair<AdjLsa&, bool>  adjLsa=pnlsr.getLsdb().getAdjLsa(lsaKey);
@@ -146,8 +149,8 @@
       if ( adjLsa.first.getLsSeqNo() >= interestedlsSeqNo )
       {
         Data data(ndn::Name(interest.getName()).appendVersion());
-        data.setFreshnessPeriod(1000); // 10 sec
-        string content=adjLsa.first.getAdjLsaData();
+        data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+        string content=adjLsa.first.getData();
         data.setContent((const uint8_t*)content.c_str(),content.size());
         pnlsr.getKeyManager().signData(data);
         cout << ">> D: " << data << endl;
@@ -157,8 +160,8 @@
   }
 
   void
-  interestManager::processInterestForCorLsa(Nlsr& pnlsr,
-      const ndn::Interest &interest,
+  InterestManager::processInterestForCorLsa(Nlsr& pnlsr,
+      const ndn::Interest& interest,
       string lsaKey, uint32_t interestedlsSeqNo)
   {
     std::pair<CorLsa&, bool>  corLsa=pnlsr.getLsdb().getCorLsa(lsaKey);
@@ -167,8 +170,8 @@
       if ( corLsa.first.getLsSeqNo() >= interestedlsSeqNo )
       {
         Data data(ndn::Name(interest.getName()).appendVersion());
-        data.setFreshnessPeriod(1000); // 10 sec
-        string content=corLsa.first.getCorLsaData();
+        data.setFreshnessPeriod(time::seconds(10)); // 10 sec
+        string content=corLsa.first.getData();
         data.setContent((const uint8_t*)content.c_str(),content.size());
         pnlsr.getKeyManager().signData(data);
         cout << ">> D: " << data << endl;
@@ -178,7 +181,7 @@
   }
 
   void
-  interestManager::processInterestKeys(Nlsr& pnlsr,const ndn::Interest &interest)
+  InterestManager::processInterestKeys(Nlsr& pnlsr,const ndn::Interest& interest)
   {
     cout<<"processInterestKeys called "<<endl;
     string intName=interest.getName().toUri();
@@ -227,7 +230,7 @@
         dataName=ndn::Name(interest.getName());
       }
       Data data(dataName.appendVersion());
-      data.setFreshnessPeriod(1000); //10 sec
+      data.setFreshnessPeriod(time::seconds(10)); //10 sec
       data.setContent(chkCert.first->wireEncode());
       pnlsr.getKeyManager().signData(data);
       pnlsr.getNlsrFace()->put(data);
@@ -236,8 +239,8 @@
 
 
   void
-  interestManager::processInterestTimedOut(Nlsr& pnlsr,
-      const ndn::Interest &interest)
+  InterestManager::processInterestTimedOut(Nlsr& pnlsr,
+      const ndn::Interest& interest)
   {
     cout << "Timed out interest : " << interest.getName().toUri() << endl;
     string intName=	interest.getName().toUri();
@@ -256,8 +259,8 @@
   }
 
   void
-  interestManager::processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
-      const ndn::Interest &interest)
+  InterestManager::processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
+      const ndn::Interest& interest)
   {
     pnlsr.getAdl().incrementTimedOutInterestCount(neighbor);
     int status=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
@@ -289,35 +292,35 @@
   }
 
   void
-  interestManager::processInterestTimedOutLsa(Nlsr& pnlsr,
-      const ndn::Interest &interest)
+  InterestManager::processInterestTimedOutLsa(Nlsr& pnlsr,
+      const ndn::Interest& interest)
   {
   }
 
   void
-  interestManager::expressInterest(Nlsr& pnlsr,const string& interestNamePrefix,
+  InterestManager::expressInterest(Nlsr& pnlsr,const string& interestNamePrefix,
                                    int scope, int seconds)
   {
     cout<<"Expressing Interest :"<<interestNamePrefix<<endl;
     ndn::Interest i((ndn::Name(interestNamePrefix)));
     //i.setScope(scope);
-    i.setInterestLifetime(seconds*1000);
+    i.setInterestLifetime(time::seconds(seconds));
     i.setMustBeFresh(true);
     pnlsr.getNlsrFace()->expressInterest(i,
                                          ndn::func_lib::bind(&DataManager::processContent,
                                              &pnlsr.getDm(), boost::ref(pnlsr),_1, _2,boost::ref(*this)),
-                                         ndn::func_lib::bind(&interestManager::processInterestTimedOut,
+                                         ndn::func_lib::bind(&InterestManager::processInterestTimedOut,
                                              this,boost::ref(pnlsr),_1));
   }
 
 
   void
-  interestManager::sendScheduledInfoInterest(Nlsr& pnlsr, int seconds)
+  InterestManager::sendScheduledInfoInterest(Nlsr& pnlsr, int seconds)
   {
     std::list<Adjacent> adjList=pnlsr.getAdl().getAdjList();
     for(std::list<Adjacent>::iterator it=adjList.begin(); it!=adjList.end(); ++it)
     {
-      string adjName=(*it).getAdjacentName()+"/"+"info"+
+      string adjName=(*it).getName()+"/"+"info"+
                      pnlsr.getConfParameter().getRouterPrefix();
       expressInterest(	pnlsr,adjName,2,
                         pnlsr.getConfParameter().getInterestResendTime());
@@ -326,10 +329,10 @@
   }
 
   void
-  interestManager::scheduleInfoInterest(Nlsr& pnlsr, int seconds)
+  InterestManager::scheduleInfoInterest(Nlsr& pnlsr, int seconds)
   {
     EventId eid=pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(seconds),
-                ndn::bind(&interestManager::sendScheduledInfoInterest, this,
+                ndn::bind(&InterestManager::sendScheduledInfoInterest, this,
                           boost::ref(pnlsr),seconds));
   }
 
diff --git a/src/communication/nlsr_im.hpp b/src/communication/nlsr_im.hpp
index c150e8f..5b74174 100644
--- a/src/communication/nlsr_im.hpp
+++ b/src/communication/nlsr_im.hpp
@@ -13,30 +13,30 @@
 
   class Nlsr;
 
-  class interestManager
+  class InterestManager
   {
   public:
-    interestManager()
+    InterestManager()
     {
     }
-    void processInterest(Nlsr& pnlsr, const ndn::Name &name,
-                         const ndn::Interest &interest);
+    void processInterest(Nlsr& pnlsr, const ndn::Name& name,
+                         const ndn::Interest& interest);
     void processInterestInfo(Nlsr& pnlsr, string& neighbor,
-                             const ndn::Interest &interest);
-    void processInterestLsa(Nlsr& pnlsr,const ndn::Interest &interest);
-    void processInterestForNameLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+                             const ndn::Interest& interest);
+    void processInterestLsa(Nlsr& pnlsr,const ndn::Interest& interest);
+    void processInterestForNameLsa(Nlsr& pnlsr, const ndn::Interest& interest,
                                    string lsaKey, uint32_t interestedlsSeqNo);
-    void processInterestForAdjLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+    void processInterestForAdjLsa(Nlsr& pnlsr, const ndn::Interest& interest,
                                   string lsaKey, uint32_t interestedlsSeqNo);
-    void processInterestForCorLsa(Nlsr& pnlsr, const ndn::Interest &interest,
+    void processInterestForCorLsa(Nlsr& pnlsr, const ndn::Interest& interest,
                                   string lsaKey, uint32_t interestedlsSeqNo);
 
-    void processInterestKeys(Nlsr& pnlsr,const ndn::Interest &interest);
+    void processInterestKeys(Nlsr& pnlsr,const ndn::Interest& interest);
 
-    void processInterestTimedOut(Nlsr& pnlsr, const ndn::Interest &interest);
+    void processInterestTimedOut(Nlsr& pnlsr, const ndn::Interest& interest);
     void processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
-                                     const ndn::Interest &interest);
-    void processInterestTimedOutLsa(Nlsr& pnlsr,const ndn::Interest &interest);
+                                     const ndn::Interest& interest);
+    void processInterestTimedOutLsa(Nlsr& pnlsr,const ndn::Interest& interest);
     void expressInterest(Nlsr& pnlsr,const string& interestNamePrefix, int scope,
                          int seconds);
     void sendScheduledInfoInterest(Nlsr& pnlsr, int seconds);
diff --git a/src/communication/nlsr_slh.cpp b/src/communication/nlsr_slh.cpp
index 189612a..70295aa 100644
--- a/src/communication/nlsr_slh.cpp
+++ b/src/communication/nlsr_slh.cpp
@@ -2,16 +2,19 @@
 #include "nlsr_slh.hpp"
 #include "security/nlsr_km.hpp"
 #include "utility/nlsr_tokenizer.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_slh.cpp"
 
 
 namespace nlsr
 {
   void
-  SyncLogicHandler::createSyncSocket(Nlsr &pnlsr )
+  SyncLogicHandler::createSyncSocket(Nlsr& pnlsr )
   {
     cout<<"Creating Sync socket ......"<<endl;
-    cout<<"Sync prefix: "<<syncPrefix.toUri()<<endl;
-    syncSocket=make_shared<SyncSocket>(syncPrefix, validator, syncFace,
+    cout<<"Sync prefix: "<<m_syncPrefix.toUri()<<endl;
+    m_syncSocket=make_shared<SyncSocket>(m_syncPrefix, m_validator, m_syncFace,
                                        bind(&SyncLogicHandler::nsyncUpdateCallBack,this,
                                             _1, _2,boost::ref(pnlsr)),
                                        bind(&SyncLogicHandler::nsyncRemoveCallBack, this,
@@ -130,10 +133,6 @@
   void
   SyncLogicHandler::publishKeyUpdate(KeyManager& km)
   {
-    //publishSyncUpdate(km.getRootCertName().toUri(), 10);
-    //publishSyncUpdate(km.getSiteCertName().toUri(), 10);
-    //publishSyncUpdate(km.getOperatorCertName().toUri(), 10);
-    //publishSyncUpdate(km.getRouterCertName().toUri(), km.getCertSeqNo());
     publishSyncUpdate(km.getProcessCertName().toUri(),km.getCertSeqNo());
   }
 
@@ -151,7 +150,7 @@
     cout<<"Seq No: "<<seqNo<<endl;
     ndn::Name updateName(updatePrefix);
     string data("NoData");
-    syncSocket->publishData(updateName,0,data.c_str(),data.size(),1000,seqNo);
+    m_syncSocket->publishData(updateName,0,data.c_str(),data.size(),1000,seqNo);
   }
 
 }
diff --git a/src/communication/nlsr_slh.hpp b/src/communication/nlsr_slh.hpp
index 420210d..4f90fd6 100644
--- a/src/communication/nlsr_slh.hpp
+++ b/src/communication/nlsr_slh.hpp
@@ -20,7 +20,7 @@
 using namespace Sync;
 using namespace std;
 
-class interestManager;
+class InterestManager;
 class ConfParameter;
 
 namespace nlsr
@@ -29,23 +29,23 @@
   {
   public:
     SyncLogicHandler(ndn::shared_ptr<boost::asio::io_service> ioService)
-      : validator(new ndn::ValidatorNull())
-      , syncFace(new ndn::Face(ioService))
+      : m_validator(new ndn::ValidatorNull())
+      , m_syncFace(new ndn::Face(ioService))
     {}
 
 
     void createSyncSocket(Nlsr& pnlsr);
-    void nsyncUpdateCallBack(const vector<MissingDataInfo> &v,
+    void nsyncUpdateCallBack(const vector<MissingDataInfo>& v,
                              SyncSocket *socket, Nlsr& pnlsr );
-    void nsyncRemoveCallBack(const string& prefix, Nlsr &pnlsr);
+    void nsyncRemoveCallBack(const string& prefix, Nlsr& pnlsr);
     void removeRouterFromSyncing(string& routerPrefix);
     void publishRoutingUpdate(SequencingManager& sm, string updatePrefix);
     void publishKeyUpdate(KeyManager& km);
     void publishIdentityUpdate(string identityName);
     void setSyncPrefix(string sp)
     {
-      syncPrefix.clear();
-      syncPrefix.set(sp);
+      m_syncPrefix.clear();
+      m_syncPrefix.set(sp);
     }
   private:
     void processUpdateFromSync(std::string updateName, uint64_t seqNo,
@@ -56,10 +56,10 @@
                                    Nlsr& pnlsr);
     void publishSyncUpdate(string updatePrefix, uint64_t seqNo);
   private:
-    ndn::shared_ptr<ndn::ValidatorNull> validator;
-    ndn::shared_ptr<ndn::Face> syncFace;
-    ndn::shared_ptr<SyncSocket> syncSocket;
-    ndn::Name syncPrefix;
+    ndn::shared_ptr<ndn::ValidatorNull> m_validator;
+    ndn::shared_ptr<ndn::Face> m_syncFace;
+    ndn::shared_ptr<SyncSocket> m_syncSocket;
+    ndn::Name m_syncPrefix;
   };
 }
 #endif
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 08338f2..13e7906 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -1,6 +1,7 @@
 #include <cstdlib>
 #include <string>
 #include <sstream>
+#include <cstdio>
 #include <ndn-cpp-dev/face.hpp>
 #include <ndn-cpp-dev/security/key-chain.hpp>
 #include <ndn-cpp-dev/security/identity-certificate.hpp>
@@ -14,6 +15,7 @@
 #include "security/nlsr_cert_store.hpp"
 #include "security/nlsr_cse.hpp"
 
+#define THIS_FILE "nlsr.cpp"
 
 namespace nlsr
 {
@@ -33,46 +35,49 @@
   Nlsr::setInterestFilterNlsr(const string& name)
   {
     getNlsrFace()->setInterestFilter(name,
-                                     func_lib::bind(&interestManager::processInterest, &im,
+                                     func_lib::bind(&InterestManager::processInterest, &m_im,
                                          boost::ref(*this), _1, _2),
                                      func_lib::bind(&Nlsr::nlsrRegistrationFailed, this, _1));
   }
 
   void
-  Nlsr::initNlsr()
+  Nlsr::initialize()
   {
-    confParam.buildRouterPrefix();
-    nlsrLogger.initNlsrLogger(confParam.getLogDir());
-    nlsrLsdb.setLsaRefreshTime(confParam.getLsaRefreshTime());
-    nlsrLsdb.setThisRouterPrefix(confParam.getRouterPrefix());
-    fib.setFibEntryRefreshTime(2*confParam.getLsaRefreshTime());
-    if( ! km.initKeyManager(confParam) )
+    src::logger lg;
+    m_confParam.buildRouterPrefix();
+    m_nlsrLogger.initNlsrLogger(m_confParam.getLogDir());
+    m_nlsrLsdb.setLsaRefreshTime(m_confParam.getLsaRefreshTime());
+    m_nlsrLsdb.setThisRouterPrefix(m_confParam.getRouterPrefix());
+    m_fib.setEntryRefreshTime(2*m_confParam.getLsaRefreshTime());
+    if( ! m_km.initialize(m_confParam) )
     {
       std::cerr<<"Can not initiate/load certificate"<<endl;
+      BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Certificate initiation"
+                   <<" error";
     }
-    sm.setSeqFileName(confParam.getSeqFileDir());
-    sm.initiateSeqNoFromFile();
+    m_sm.setSeqFileName(m_confParam.getSeqFileDir());
+    m_sm.initiateSeqNoFromFile();
     /* debugging purpose start */
-    cout <<	confParam;
-    adl.printAdl();
-    npl.printNpl();
+    cout <<	m_confParam;
+    m_adl.printAdl();
+    m_npl.print();
     /* debugging purpose end */
-    nlsrLsdb.buildAndInstallOwnNameLsa(boost::ref(*this));
-    nlsrLsdb.buildAndInstallOwnCorLsa(boost::ref(*this));
-    setInterestFilterNlsr(confParam.getRouterPrefix());
-    setInterestFilterNlsr(confParam.getChronosyncLsaPrefix()+
-                          confParam.getRouterPrefix());
-    setInterestFilterNlsr(confParam.getRootKeyPrefix());
-    slh.setSyncPrefix(confParam.getChronosyncSyncPrefix());
-    slh.createSyncSocket(boost::ref(*this));
-    slh.publishKeyUpdate(km);
-    im.scheduleInfoInterest(boost::ref(*this),10);
+    m_nlsrLsdb.buildAndInstallOwnNameLsa(boost::ref(*this));
+    m_nlsrLsdb.buildAndInstallOwnCorLsa(boost::ref(*this));
+    setInterestFilterNlsr(m_confParam.getRouterPrefix());
+    setInterestFilterNlsr(m_confParam.getChronosyncLsaPrefix()+
+                          m_confParam.getRouterPrefix());
+    setInterestFilterNlsr(m_confParam.getRootKeyPrefix());
+    m_slh.setSyncPrefix(m_confParam.getChronosyncSyncPrefix());
+    m_slh.createSyncSocket(boost::ref(*this));
+    m_slh.publishKeyUpdate(m_km);
+    m_im.scheduleInfoInterest(boost::ref(*this),10);
   }
 
   void
   Nlsr::startEventLoop()
   {
-    io->run();
+    m_io->run();
   }
 
   int
@@ -95,6 +100,7 @@
 int
 main(int argc, char **argv)
 {
+  src::logger lg;
   nlsr::Nlsr nlsr_;
   string programName(argv[0]);
   nlsr_.setConfFileName("nlsr.conf");
@@ -102,7 +108,7 @@
   while ((opt = getopt(argc, argv, "df:p:h")) != -1)
   {
     switch (opt)
-    {
+      {
       case 'f':
         nlsr_.setConfFileName(optarg);
         break;
@@ -121,15 +127,16 @@
       default:
         nlsr_.usage(programName);
         return EXIT_FAILURE;
-    }
+      }
   }
   ConfFileProcessor cfp(nlsr_.getConfFileName());
   int res=cfp.processConfFile(nlsr_);
   if ( res < 0 )
   {
+    std::cerr<<"Error in configuration file processing! Exiting from NLSR"<<std::endl;
     return EXIT_FAILURE;
   }
-  nlsr_.initNlsr();
+  nlsr_.initialize();
   try
   {
     nlsr_.startEventLoop();
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 9a580f3..0c406ac 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -30,28 +30,28 @@
   {
   public:
     Nlsr()
-      : io(ndn::make_shared<boost::asio::io_service>())
-      , nlsrFace(make_shared<ndn::Face>(io))
-      , scheduler(*io)
-      , confParam()
-      , adl()
-      , npl()
-      , im()
-      , dm()
-      , sm()
-      , km()
+      : m_io(ndn::make_shared<boost::asio::io_service>())
+      , m_nlsrFace(make_shared<ndn::Face>(m_io))
+      , m_scheduler(*m_io)
+      , m_confParam()
+      , m_adl()
+      , m_npl()
+      , m_im()
+      , m_dm()
+      , m_sm()
+      , m_km()
       , isDaemonProcess(false)
-      , configFileName("nlsr.conf")
-      , nlsrLsdb()
-      , adjBuildCount(0)
+      , m_configFileName("nlsr.conf")
+      , m_nlsrLsdb()
+      , m_adjBuildCount(0)
       , isBuildAdjLsaSheduled(0)
       , isRouteCalculationScheduled(0)
       , isRoutingTableCalculating(0)
-      , routingTable()
-      , npt()
-      , fib()
-      , slh(io)
-      , nlsrLogger()
+      , m_routingTable()
+      , m_npt()
+      , m_fib()
+      , m_slh(m_io)
+      , m_nlsrLogger()
     {}
 
     void nlsrRegistrationFailed(const ndn::Name& name);
@@ -63,15 +63,15 @@
 
     string getConfFileName()
     {
-      return configFileName;
+      return m_configFileName;
     }
 
     void setConfFileName(const string& fileName)
     {
-      configFileName=fileName;
+      m_configFileName=fileName;
     }
 
-    bool isSetDaemonProcess()
+    bool getIsSetDaemonProcess()
     {
       return isDaemonProcess;
     }
@@ -83,88 +83,88 @@
 
     ConfParameter& getConfParameter()
     {
-      return confParam;
+      return m_confParam;
     }
 
     Adl& getAdl()
     {
-      return adl;
+      return m_adl;
     }
 
     Npl& getNpl()
     {
-      return npl;
+      return m_npl;
     }
 
     ndn::shared_ptr<boost::asio::io_service>& getIo()
     {
-      return io;
+      return m_io;
     }
 
     ndn::Scheduler& getScheduler()
     {
-      return scheduler;
+      return m_scheduler;
     }
 
     ndn::shared_ptr<ndn::Face> getNlsrFace()
     {
-      return nlsrFace;
+      return m_nlsrFace;
     }
 
     KeyManager& getKeyManager()
     {
-      return km;
+      return m_km;
     }
 
 
-    interestManager& getIm()
+    InterestManager& getIm()
     {
-      return im;
+      return m_im;
     }
 
     DataManager& getDm()
     {
-      return dm;
+      return m_dm;
     }
 
     SequencingManager& getSm()
     {
-      return sm;
+      return m_sm;
     }
 
     Lsdb& getLsdb()
     {
-      return nlsrLsdb;
+      return m_nlsrLsdb;
     }
 
     RoutingTable& getRoutingTable()
     {
-      return routingTable;
+      return m_routingTable;
     }
 
     Npt& getNpt()
     {
-      return npt;
+      return m_npt;
     }
 
     Fib& getFib()
     {
-      return fib;
+      return m_fib;
     }
 
     long int getAdjBuildCount()
     {
-      return adjBuildCount;
+      return m_adjBuildCount;
     }
 
     void incrementAdjBuildCount()
     {
-      adjBuildCount++;
+      m_adjBuildCount++;
     }
 
     void setAdjBuildCount(long int abc)
     {
-      adjBuildCount=abc;
+      m_adjBuildCount=abc;
     }
 
     int getIsBuildAdjLsaSheduled()
@@ -172,7 +172,7 @@
       return isBuildAdjLsaSheduled;
     }
 
-    void setIsBuildAdjLsaSheduled(int iabls)
+    void setIsBuildAdjLsaSheduled(bool iabls)
     {
       isBuildAdjLsaSheduled=iabls;
     }
@@ -180,72 +180,72 @@
 
     void setApiPort(int ap)
     {
-      apiPort=ap;
+      m_apiPort=ap;
     }
 
     int getApiPort()
     {
-      return apiPort;
+      return m_apiPort;
     }
 
-    int getIsRoutingTableCalculating()
+    bool getIsRoutingTableCalculating()
     {
       return isRoutingTableCalculating;
     }
 
-    void setIsRoutingTableCalculating(int irtc)
+    void setIsRoutingTableCalculating(bool irtc)
     {
       isRoutingTableCalculating=irtc;
     }
 
-    int getIsRouteCalculationScheduled()
+    bool getIsRouteCalculationScheduled()
     {
       return isRouteCalculationScheduled;
     }
 
-    void setIsRouteCalculationScheduled(int ircs)
+    void setIsRouteCalculationScheduled(bool ircs)
     {
       isRouteCalculationScheduled=ircs;
     }
 
     SyncLogicHandler& getSlh()
     {
-      return slh;
+      return m_slh;
     }
 
     NlsrLogger& getNlsrLogger()
     {
-      return nlsrLogger;
+      return m_nlsrLogger;
     }
 
-    void initNlsr();
+    void initialize();
 
   private:
-    ConfParameter confParam;
-    Adl adl;
-    Npl npl;
-    ndn::shared_ptr<boost::asio::io_service> io;
-    ndn::Scheduler scheduler;
-    ndn::shared_ptr<ndn::Face> nlsrFace;
-    interestManager im;
-    DataManager dm;
-    SequencingManager sm;
-    KeyManager km;
+    ConfParameter m_confParam;
+    Adl m_adl;
+    Npl m_npl;
+    ndn::shared_ptr<boost::asio::io_service> m_io;
+    ndn::Scheduler m_scheduler;
+    ndn::shared_ptr<ndn::Face> m_nlsrFace;
+    InterestManager m_im;
+    DataManager m_dm;
+    SequencingManager m_sm;
+    KeyManager m_km;
     bool isDaemonProcess;
-    string configFileName;
-    int apiPort;
+    string m_configFileName;
+    int m_apiPort;
 
-    Lsdb nlsrLsdb;
-    RoutingTable routingTable;
-    Npt npt;
-    Fib fib;
-    SyncLogicHandler slh;
-    NlsrLogger nlsrLogger;
+    Lsdb m_nlsrLsdb;
+    RoutingTable m_routingTable;
+    Npt m_npt;
+    Fib m_fib;
+    SyncLogicHandler m_slh;
+    NlsrLogger m_nlsrLogger;
 
-    long int adjBuildCount;
-    int isBuildAdjLsaSheduled;
-    int isRouteCalculationScheduled;
-    int isRoutingTableCalculating;
+    long int m_adjBuildCount;
+    bool isBuildAdjLsaSheduled;
+    bool isRouteCalculationScheduled;
+    bool isRoutingTableCalculating;
 
 
 
diff --git a/src/nlsr_adjacent.cpp b/src/nlsr_adjacent.cpp
index f636e5c..6ef9c0b 100644
--- a/src/nlsr_adjacent.cpp
+++ b/src/nlsr_adjacent.cpp
@@ -2,8 +2,10 @@
 #include<string>
 #include<cmath>
 #include<limits>
-
 #include "nlsr_adjacent.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_adjacent.cpp"
 
 namespace nlsr
 {
@@ -12,26 +14,26 @@
 
   Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton)
   {
-    adjacentName=an;
-    connectingFace=cf;
-    linkCost=lc;
-    status=s;
-    interestTimedOutNo=iton;
+    m_name=an;
+    m_connectingFace=cf;
+    m_linkCost=lc;
+    m_status=s;
+    m_interestTimedOutNo=iton;
   }
 
   bool
-  Adjacent::isAdjacentEqual(Adjacent& adj)
+  Adjacent::isEqual(Adjacent& adj)
   {
-    return ( adjacentName == adj.getAdjacentName() ) &&
-           ( connectingFace == adj.getConnectingFace() ) &&
-           (std::abs(linkCost - adj.getLinkCost()) <
+    return ( m_name == adj.getName() ) &&
+           ( m_connectingFace == adj.getConnectingFace() ) &&
+           (std::abs(m_linkCost - adj.getLinkCost()) <
             std::numeric_limits<double>::epsilon()) ;
   }
 
   std::ostream&
   operator << (std::ostream &os, Adjacent &adj)
   {
-    cout<<"Adjacent : "<< adj.getAdjacentName()	<< endl;
+    cout<<"Adjacent : "<< adj.getName()	<< endl;
     cout<<"Connecting Face: "<<adj.getConnectingFace()<<endl;
     cout<<"Link Cost: "<<adj.getLinkCost()<<endl;
     cout<<"Status: "<<adj.getStatus()<<endl;
diff --git a/src/nlsr_adjacent.hpp b/src/nlsr_adjacent.hpp
index 23f334c..f9a789a 100644
--- a/src/nlsr_adjacent.hpp
+++ b/src/nlsr_adjacent.hpp
@@ -11,82 +11,82 @@
 
   public:
     Adjacent()
-      :adjacentName()
-      ,connectingFace(0)
-      ,linkCost(10.0)
-      ,status(0)
-      ,interestTimedOutNo(0)
+      :m_name()
+      ,m_connectingFace(0)
+      ,m_linkCost(10.0)
+      ,m_status(0)
+      ,m_interestTimedOutNo(0)
     {
     }
 
     Adjacent(const string& an)
-      :connectingFace(0)
-      ,linkCost(0.0)
-      ,status(0)
-      ,interestTimedOutNo(0)
+      :m_connectingFace(0)
+      ,m_linkCost(0.0)
+      ,m_status(0)
+      ,m_interestTimedOutNo(0)
     {
-      adjacentName=an;
+      m_name=an;
     }
 
     Adjacent(const string& an, int cf, double lc, int s, int iton);
 
-    string getAdjacentName()
+    string getName()
     {
-      return adjacentName;
+      return m_name;
     }
 
-    void setAdjacentName(const string& an)
+    void setName(const string& an)
     {
-      adjacentName=an;
+      m_name=an;
     }
 
     int getConnectingFace()
     {
-      return connectingFace;
+      return m_connectingFace;
     }
 
     void setConnectingFace(int cf)
     {
-      connectingFace=cf;
+      m_connectingFace=cf;
     }
 
     double getLinkCost()
     {
-      return linkCost;
+      return m_linkCost;
     }
 
     void setLinkCost(double lc)
     {
-      linkCost=lc;
+      m_linkCost=lc;
     }
 
     int getStatus()
     {
-      return status;
+      return m_status;
     }
 
     void setStatus(int s)
     {
-      status=s;
+      m_status=s;
     }
 
     int getInterestTimedOutNo()
     {
-      return interestTimedOutNo;
+      return m_interestTimedOutNo;
     }
 
     void setInterestTimedOutNo(int iton)
     {
-      interestTimedOutNo=iton;
+      m_interestTimedOutNo=iton;
     }
 
-    bool isAdjacentEqual(Adjacent& adj);
+    bool isEqual(Adjacent& adj);
   private:
-    string adjacentName;
-    int connectingFace;
-    double linkCost;
-    int status;
-    int interestTimedOutNo;
+    string m_name;
+    int m_connectingFace;
+    double m_linkCost;
+    int m_status;
+    int m_interestTimedOutNo;
   };
 
   std::ostream&
diff --git a/src/nlsr_adl.cpp b/src/nlsr_adl.cpp
index ab5db84..fd84f9e 100644
--- a/src/nlsr_adl.cpp
+++ b/src/nlsr_adl.cpp
@@ -4,6 +4,9 @@
 #include "nlsr_adl.hpp"
 #include "nlsr_adjacent.hpp"
 #include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_adl.cpp"
 
 namespace nlsr
 {
@@ -19,20 +22,20 @@
   static bool
   adjacent_compare(Adjacent& adj1, Adjacent& adj2)
   {
-    return adj1.getAdjacentName()==adj2.getAdjacentName();
+    return adj1.getName()==adj2.getName();
   }
 
   int
   Adl::insert(Adjacent& adj)
   {
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if ( it != adjList.end() )
+    if ( it != m_adjList.end() )
     {
       return -1;
     }
-    adjList.push_back(adj);
+    m_adjList.push_back(adj);
     return 0;
   }
 
@@ -50,10 +53,10 @@
   Adl::updateAdjacentStatus(string adjName, int s)
   {
     Adjacent adj(adjName);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return -1;
     }
@@ -65,10 +68,10 @@
   Adl::getAdjacent(string adjName)
   {
     Adjacent adj(adjName);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it != adjList.end())
+    if( it != m_adjList.end())
     {
       return (*it);
     }
@@ -77,28 +80,28 @@
 
 
   bool
-  Adl::isAdlEqual(Adl &adl)
+  Adl::isEqual(Adl& adl)
   {
-    if ( getAdlSize() != adl.getAdlSize() )
+    if ( getSize() != adl.getSize() )
     {
       return false;
     }
-    adjList.sort(adjacent_compare);
+    m_adjList.sort(adjacent_compare);
     adl.getAdjList().sort(adjacent_compare);
     int equalAdjCount=0;
     std::list< Adjacent > adjList2=adl.getAdjList();
     std::list<Adjacent>::iterator it1;
     std::list<Adjacent>::iterator it2;
-    for(it1=adjList.begin() , it2=adjList2.begin() ;
-        it1!=adjList.end(); it1++,it2++)
+    for(it1=m_adjList.begin() , it2=adjList2.begin() ;
+        it1!=m_adjList.end(); it1++,it2++)
     {
-      if ( !(*it1).isAdjacentEqual((*it2)) )
+      if ( !(*it1).isEqual((*it2)) )
       {
         break;
       }
       equalAdjCount++;
     }
-    return equalAdjCount==getAdlSize();
+    return equalAdjCount==getSize();
   }
 
 
@@ -106,10 +109,10 @@
   Adl::updateAdjacentLinkCost(string adjName, double lc)
   {
     Adjacent adj(adjName);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return -1;
     }
@@ -121,10 +124,10 @@
   Adl::isNeighbor(string adjName)
   {
     Adjacent adj(adjName);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return false;
     }
@@ -135,10 +138,10 @@
   Adl::incrementTimedOutInterestCount(string& neighbor)
   {
     Adjacent adj(neighbor);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return ;
     }
@@ -149,10 +152,10 @@
   Adl::setTimedOutInterestCount(string& neighbor, int count)
   {
     Adjacent adj(neighbor);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it != adjList.end())
+    if( it != m_adjList.end())
     {
       (*it).setInterestTimedOutNo(count);
     }
@@ -162,10 +165,10 @@
   Adl::getTimedOutInterestCount(string& neighbor)
   {
     Adjacent adj(neighbor);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return -1;
     }
@@ -176,10 +179,10 @@
   Adl::getStatusOfNeighbor(string& neighbor)
   {
     Adjacent adj(neighbor);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it == adjList.end())
+    if( it == m_adjList.end())
     {
       return -1;
     }
@@ -190,10 +193,10 @@
   Adl::setStatusOfNeighbor(string& neighbor, int status)
   {
     Adjacent adj(neighbor);
-    std::list<Adjacent >::iterator it = std::find_if( adjList.begin(),
-                                        adjList.end(),
+    std::list<Adjacent >::iterator it = std::find_if( m_adjList.begin(),
+                                        m_adjList.end(),
                                         bind(&adjacent_compare, _1, adj));
-    if( it != adjList.end())
+    if( it != m_adjList.end())
     {
       (*it).setStatus(status);
     }
@@ -202,15 +205,15 @@
   std::list<Adjacent>&
   Adl::getAdjList()
   {
-    return adjList;
+    return m_adjList;
   }
 
   bool
   Adl::isAdjLsaBuildable(Nlsr& pnlsr)
   {
     int nbrCount=0;
-    for( std::list<Adjacent>::iterator it=adjList.begin();
-         it!= adjList.end() ; it++)
+    for( std::list<Adjacent>::iterator it=m_adjList.begin();
+         it!= m_adjList.end() ; it++)
     {
       if ( ((*it).getStatus() == 1 ) )
       {
@@ -225,7 +228,7 @@
         }
       }
     }
-    if( nbrCount == adjList.size())
+    if( nbrCount == m_adjList.size())
     {
       return true;
     }
@@ -236,8 +239,8 @@
   Adl::getNumOfActiveNeighbor()
   {
     int actNbrCount=0;
-    for( std::list<Adjacent>::iterator it=adjList.begin();
-         it!= adjList.end() ; it++)
+    for( std::list<Adjacent>::iterator it=m_adjList.begin();
+         it!= m_adjList.end() ; it++)
     {
       if ( ((*it).getStatus() == 1 ) )
       {
@@ -251,7 +254,7 @@
   void
   Adl::printAdl()
   {
-    for( std::list<Adjacent>::iterator it=adjList.begin(); it!= adjList.end() ;
+    for( std::list<Adjacent>::iterator it=m_adjList.begin(); it!= m_adjList.end() ;
          it++)
     {
       cout<< (*it) <<endl;
diff --git a/src/nlsr_adl.hpp b/src/nlsr_adl.hpp
index 82edaf0..ad85f01 100644
--- a/src/nlsr_adl.hpp
+++ b/src/nlsr_adl.hpp
@@ -34,25 +34,25 @@
     int getNumOfActiveNeighbor();
     Adjacent getAdjacent(string adjName);
 
-    bool isAdlEqual(Adl &adl);
+    bool isEqual(Adl& adl);
 
-    int getAdlSize()
+    int getSize()
     {
-      return adjList.size();
+      return m_adjList.size();
     }
 
-    void resetAdl()
+    void reset()
     {
-      if( adjList.size() > 0 )
+      if( m_adjList.size() > 0 )
       {
-        adjList.clear();
+        m_adjList.clear();
       }
     }
 
     void printAdl();
 
   private:
-    std::list< Adjacent > adjList;
+    std::list< Adjacent > m_adjList;
   };
 
 } //namespace nlsr
diff --git a/src/nlsr_conf_param.cpp b/src/nlsr_conf_param.cpp
index 4f879e3..84f0f74 100644
--- a/src/nlsr_conf_param.cpp
+++ b/src/nlsr_conf_param.cpp
@@ -1,5 +1,7 @@
 #include<iostream>
 #include "nlsr_conf_param.hpp"
+#include "utility/nlsr_logger.hpp"
+#define THIS_FILE "nlsr_conf_param.cpp"
 
 namespace nlsr
 {
@@ -7,7 +9,7 @@
   using namespace std;
 
   ostream&
-  operator << (ostream &os, ConfParameter& cfp)
+  operator << (ostream& os, ConfParameter& cfp)
   {
     os  <<"Router Name: "<< cfp.getRouterName()<<endl;
     os  <<"Site Name: "<< cfp.getSiteName()<<endl;
diff --git a/src/nlsr_conf_param.hpp b/src/nlsr_conf_param.hpp
index 9446009..ddfa1a0 100644
--- a/src/nlsr_conf_param.hpp
+++ b/src/nlsr_conf_param.hpp
@@ -13,285 +13,285 @@
 
   public:
     ConfParameter()
-      : chronosyncSyncPrefix("ndn/nlsr/sync")
-      , chronosyncLsaPrefix("/ndn/nlsr/LSA")
-      , rootKeyPrefix("/ndn/keys")
+      : m_chronosyncSyncPrefix("ndn/nlsr/sync")
+      , m_chronosyncLsaPrefix("/ndn/nlsr/LSA")
+      , m_rootKeyPrefix("/ndn/keys")
       , isStrictHierchicalKeyCheck(0)
-      , interestRetryNumber(3)
-      , interestResendTime(5)
-      , infoInterestInterval(60)
-      , lsaRefreshTime(1800)
-      , routerDeadInterval(3600)
-      , maxFacesPerPrefix(0)
-      , tunnelType(0)
-      , detailedLogging(0)
-      , certDir()
-      , debugging(0)
+      , m_interestRetryNumber(3)
+      , m_interestResendTime(5)
+      , m_infoInterestInterval(60)
+      , m_lsaRefreshTime(1800)
+      , m_routerDeadInterval(3600)
+      , m_maxFacesPerPrefix(0)
+      , m_tunnelType(0)
+      , m_detailedLogging(0)
+      , m_certDir()
+      , m_debugging(0)
       , isHyperbolicCalc(0)
-      , seqFileDir()
-      , corR(0)
-      , corTheta(0)
+      , m_seqFileDir()
+      , m_corR(0)
+      , m_corTheta(0)
     {}
 
     void setRouterName(const string& rn)
     {
-      routerName=rn;
+      m_routerName=rn;
     }
 
     string getRouterName()
     {
-      return routerName;
+      return m_routerName;
     }
 
     void setSiteName(const string& sn)
     {
-      siteName=sn;
+      m_siteName=sn;
     }
 
     string getSiteName()
     {
-      return siteName;
+      return m_siteName;
     }
 
     void setNetwork(const string& nn)
     {
-      network=nn;
+      m_network=nn;
     }
 
     string getNetwork()
     {
-      return network;
+      return m_network;
     }
 
     void buildRouterPrefix()
     {
-      routerPrefix="/"+network+"/"+siteName+"/"+routerName;
+      m_routerPrefix="/"+m_network+"/"+m_siteName+"/"+m_routerName;
     }
 
     string getRouterPrefix()
     {
-      return routerPrefix;
+      return m_routerPrefix;
     }
 
     string getRootKeyPrefix()
     {
-      return rootKeyPrefix;
+      return m_rootKeyPrefix;
     }
 
     void setRootKeyPrefix(string rkp)
     {
-      rootKeyPrefix=rkp;
+      m_rootKeyPrefix=rkp;
     }
 
     void setInterestRetryNumber(int irn)
     {
-      interestRetryNumber=irn;
+      m_interestRetryNumber=irn;
     }
 
     int getInterestRetryNumber()
     {
-      return interestRetryNumber;
+      return m_interestRetryNumber;
     }
 
     void setInterestResendTime(int irt)
     {
-      interestResendTime=irt;
+      m_interestResendTime=irt;
     }
 
     int getInterestResendTime()
     {
-      return interestResendTime;
+      return m_interestResendTime;
     }
 
     void setLsaRefreshTime(int lrt)
     {
-      lsaRefreshTime=lrt;
-      routerDeadInterval=2*lsaRefreshTime;
+      m_lsaRefreshTime=lrt;
+      m_routerDeadInterval=2*m_lsaRefreshTime;
     }
 
     int getLsaRefreshTime()
     {
-      return lsaRefreshTime;
+      return m_lsaRefreshTime;
     }
 
     void setRouterDeadInterval(int rdt)
     {
-      routerDeadInterval=rdt;
+      m_routerDeadInterval=rdt;
     }
 
     long int getRouterDeadInterval()
     {
-      return routerDeadInterval;
+      return m_routerDeadInterval;
     }
 
     void setMaxFacesPerPrefix(int mfpp)
     {
-      maxFacesPerPrefix=mfpp;
+      m_maxFacesPerPrefix=mfpp;
     }
 
     int getMaxFacesPerPrefix()
     {
-      return maxFacesPerPrefix;
+      return m_maxFacesPerPrefix;
     }
 
     void setLogDir(string ld)
     {
-      logDir=ld;
+      m_logDir=ld;
     }
 
     string getLogDir()
     {
-      return logDir;
+      return m_logDir;
     }
 
     void setCertDir(std::string cd)
     {
-      certDir=cd;
+      m_certDir=cd;
     }
 
     std::string getCertDir()
     {
-      return certDir;
+      return m_certDir;
     }
 
     void setSeqFileDir(string ssfd)
     {
-      seqFileDir=ssfd;
+      m_seqFileDir=ssfd;
     }
 
     string getSeqFileDir()
     {
-      return seqFileDir;
+      return m_seqFileDir;
     }
 
     void setDetailedLogging(int dl)
     {
-      detailedLogging=dl;
+      m_detailedLogging=dl;
     }
 
     int getDetailedLogging()
     {
-      return detailedLogging;
+      return m_detailedLogging;
     }
 
     void setDebugging(int d)
     {
-      debugging=d;
+      m_debugging=d;
     }
 
     int getDebugging()
     {
-      return debugging;
+      return m_debugging;
     }
 
-    void setIsHyperbolicCalc(int ihc)
+    void setIsHyperbolicCalc(bool ihc)
     {
       isHyperbolicCalc=ihc;
     }
 
-    int getIsHyperbolicCalc()
+    bool getIsHyperbolicCalc()
     {
       return isHyperbolicCalc;
     }
 
     void setCorR(double cr)
     {
-      corR=cr;
+      m_corR=cr;
     }
 
     double getCorR()
     {
-      return corR;
+      return m_corR;
     }
 
     void setCorTheta(double ct)
     {
-      corTheta=ct;
+      m_corTheta=ct;
     }
 
     double getCorTheta()
     {
-      return corTheta;
+      return m_corTheta;
     }
 
     void setTunnelType(int tt)
     {
-      tunnelType=tt;
+      m_tunnelType=tt;
     }
 
     int getTunnelType()
     {
-      return tunnelType;
+      return m_tunnelType;
     }
 
     void setChronosyncSyncPrefix(const string& csp)
     {
-      chronosyncSyncPrefix=csp;
+      m_chronosyncSyncPrefix=csp;
     }
 
     string getChronosyncSyncPrefix()
     {
-      return chronosyncSyncPrefix;
+      return m_chronosyncSyncPrefix;
     }
 
     void setChronosyncLsaPrefix(string clp)
     {
-      chronosyncLsaPrefix=clp;
+      m_chronosyncLsaPrefix=clp;
     }
 
     string getChronosyncLsaPrefix()
     {
-      return chronosyncLsaPrefix;
+      return m_chronosyncLsaPrefix;
     }
 
     int getInfoInterestInterval()
     {
-      return infoInterestInterval;
+      return m_infoInterestInterval;
     }
 
     void setInfoInterestInterval(int iii)
     {
-      infoInterestInterval=iii;
+      m_infoInterestInterval=iii;
     }
 
   private:
-    string routerName;
-    string siteName;
-    string network;
+    string m_routerName;
+    string m_siteName;
+    string m_network;
 
-    string routerPrefix;
-    string lsaRouterPrefix;
+    string m_routerPrefix;
+    string m_lsaRouterPrefix;
 
-    string chronosyncSyncPrefix;
-    string chronosyncLsaPrefix;
+    string m_chronosyncSyncPrefix;
+    string m_chronosyncLsaPrefix;
 
-    string rootKeyPrefix;
+    string m_rootKeyPrefix;
 
-    int interestRetryNumber;
-    int interestResendTime;
-    int infoInterestInterval;
-    int lsaRefreshTime;
-    int routerDeadInterval;
+    int m_interestRetryNumber;
+    int m_interestResendTime;
+    int m_infoInterestInterval;
+    int m_lsaRefreshTime;
+    int m_routerDeadInterval;
 
-    int maxFacesPerPrefix;
-    string logDir;
-    string certDir;
-    string seqFileDir;
-    string logFile;
-    int detailedLogging;
-    int debugging;
+    int m_maxFacesPerPrefix;
+    string m_logDir;
+    string m_certDir;
+    string m_seqFileDir;
+    string m_logFile;
+    int m_detailedLogging;
+    int m_debugging;
 
-    int isHyperbolicCalc;
-    double corR;
-    double corTheta;
+    bool isHyperbolicCalc;
+    double m_corR;
+    double m_corTheta;
 
-    int tunnelType;
-    int isStrictHierchicalKeyCheck;
+    int m_tunnelType;
+    bool isStrictHierchicalKeyCheck;
 
   };
 
   std::ostream&
-  operator << (std::ostream &os, ConfParameter &cfp);
+  operator << (std::ostream& os, ConfParameter& cfp);
 
 } // namespace nlsr
 
diff --git a/src/nlsr_conf_processor.cpp b/src/nlsr_conf_processor.cpp
index 627be79..fd3c9ef 100644
--- a/src/nlsr_conf_processor.cpp
+++ b/src/nlsr_conf_processor.cpp
@@ -8,6 +8,9 @@
 #include "nlsr_conf_param.hpp"
 #include "utility/nlsr_tokenizer.hpp"
 #include "nlsr_adjacent.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_conf_processor.cpp"
 
 
 namespace nlsr
@@ -19,9 +22,9 @@
   ConfFileProcessor::processConfFile(Nlsr& pnlsr)
   {
     int ret=0;
-    if ( !confFileName.empty())
+    if ( !m_confFileName.empty())
     {
-      std::ifstream inputFile(confFileName.c_str());
+      std::ifstream inputFile(m_confFileName.c_str());
       if ( inputFile.is_open())
       {
         for( string line; getline( inputFile, line ); )
@@ -41,7 +44,7 @@
       }
       else
       {
-        std::cerr <<"Configuration file: ("<<confFileName<<") does not exist :(";
+        std::cerr <<"Configuration file: ("<<m_confFileName<<") does not exist :(";
         std::cerr <<endl;
         ret=-1;
       }
@@ -527,7 +530,7 @@
     }
     else
     {
-      pnlsr.getNpl().insertIntoNpl(command);
+      pnlsr.getNpl().insert(command);
     }
     return 0;
   }
diff --git a/src/nlsr_conf_processor.hpp b/src/nlsr_conf_processor.hpp
index 25861a2..8448823 100644
--- a/src/nlsr_conf_processor.hpp
+++ b/src/nlsr_conf_processor.hpp
@@ -12,12 +12,12 @@
   {
   public:
     ConfFileProcessor()
-      :confFileName()
+      :m_confFileName()
     {
     }
     ConfFileProcessor(const string& cfile)
     {
-      confFileName=cfile;
+      m_confFileName=cfile;
     }
 
     int processConfFile(Nlsr& pnlsr);
@@ -49,7 +49,7 @@
 
 
   private:
-    string confFileName;
+    string m_confFileName;
   };
 
 } //namespace nlsr
diff --git a/src/nlsr_lsa.cpp b/src/nlsr_lsa.cpp
index 4354393..0f97568 100644
--- a/src/nlsr_lsa.cpp
+++ b/src/nlsr_lsa.cpp
@@ -10,7 +10,9 @@
 #include "nlsr_npl.hpp"
 #include "nlsr_adjacent.hpp"
 #include "utility/nlsr_tokenizer.hpp"
+#include "utility/nlsr_logger.hpp"
 
+#define THIS_FILE "nlsr_lsa.cpp"
 
 namespace nlsr
 {
@@ -19,36 +21,36 @@
 
 
   string
-  NameLsa::getNameLsaKey()
+  NameLsa::getKey()
   {
     string key;
-    key=origRouter + "/" + boost::lexical_cast<std::string>(1);
+    key=m_origRouter + "/" + boost::lexical_cast<std::string>(1);
     return key;
   }
 
   NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl)
   {
-    origRouter=origR;
-    lsType=lst;
-    lsSeqNo=lsn;
-    lifeTime=lt;
+    m_origRouter=origR;
+    m_lsType=lst;
+    m_lsSeqNo=lsn;
+    m_lifeTime=lt;
     std::list<string> nl=npl.getNameList();
     for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
     {
-      addNameToLsa((*it));
+      addName((*it));
     }
   }
 
   string
-  NameLsa::getNameLsaData()
+  NameLsa::getData()
   {
     string nameLsaData;
-    nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(1) + "|"
-                + boost::lexical_cast<std::string>(lsSeqNo) + "|"
-                + boost::lexical_cast<std::string>(lifeTime);
+    nameLsaData=m_origRouter + "|" + boost::lexical_cast<std::string>(1) + "|"
+                + boost::lexical_cast<std::string>(m_lsSeqNo) + "|"
+                + boost::lexical_cast<std::string>(m_lifeTime);
     nameLsaData+="|";
-    nameLsaData+=boost::lexical_cast<std::string>(npl.getNplSize());
-    std::list<string> nl=npl.getNameList();
+    nameLsaData+=boost::lexical_cast<std::string>(m_npl.getSize());
+    std::list<string> nl=m_npl.getNameList();
     for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
     {
       nameLsaData+="|";
@@ -58,20 +60,20 @@
   }
 
   bool
-  NameLsa::initNameLsaFromContent(string content)
+  NameLsa::initializeFromContent(string content)
   {
     uint32_t numName=0;
     nlsrTokenizer nt(content, "|");
-    origRouter=nt.getNextToken();
-    if(origRouter.empty())
+    m_origRouter=nt.getNextToken();
+    if(m_origRouter.empty())
     {
       return false;
     }
     try
     {
-      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
-      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
-      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
+      m_lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
       numName=boost::lexical_cast<uint32_t>(nt.getNextToken());
     }
     catch(std::exception &e)
@@ -81,10 +83,30 @@
     for(int i=0; i<numName; i++)
     {
       string name=nt.getNextToken();
-      addNameToLsa(name);
+      addName(name);
     }
     return true;
   }
+  
+  void
+  NameLsa::writeLog()
+  {
+    src::logger lg;
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Name-LSA";
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"  Origination Router: "
+                 <<m_origRouter;
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"  LS Type: "<<m_lsType;
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"  LS Seq: "<<m_lsSeqNo;
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"  LS Lifetime: "<<m_lifeTime;
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"  LS Data: ";
+    int i=1;
+    std::list<string> nl=m_npl.getNameList();
+    for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
+    {
+      BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"    Name "<<i<<": "<<(*it);
+    }
+    BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"name_lsa_end";
+  }
 
   std::ostream&
   operator<<(std::ostream& os, NameLsa& nLsa)
@@ -109,60 +131,60 @@
   CorLsa::CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
                  , double r, double theta)
   {
-    origRouter=origR;
-    lsType=lst;
-    lsSeqNo=lsn;
-    lifeTime=lt;
-    corRad=r;
-    corTheta=theta;
+    m_origRouter=origR;
+    m_lsType=lst;
+    m_lsSeqNo=lsn;
+    m_lifeTime=lt;
+    m_corRad=r;
+    m_corTheta=theta;
   }
 
   string
-  CorLsa::getCorLsaKey()
+  CorLsa::getKey()
   {
     string key;
-    key=origRouter + "/" + boost::lexical_cast<std::string>(3);
+    key=m_origRouter + "/" + boost::lexical_cast<std::string>(3);
     return key;
   }
 
   bool
-  CorLsa::isLsaContentEqual(CorLsa& clsa)
+  CorLsa::isEqual(CorLsa& clsa)
   {
-    return (std::abs(corRad - clsa.getCorRadius()) <
+    return (std::abs(m_corRad - clsa.getCorRadius()) <
             std::numeric_limits<double>::epsilon()) &&
-           (std::abs(corTheta - clsa.getCorTheta()) <
+           (std::abs(m_corTheta - clsa.getCorTheta()) <
             std::numeric_limits<double>::epsilon());
   }
 
   string
-  CorLsa::getCorLsaData()
+  CorLsa::getData()
   {
     string corLsaData;
-    corLsaData=origRouter + "|";
+    corLsaData=m_origRouter + "|";
     corLsaData+=(boost::lexical_cast<std::string>(3) + "|");
-    corLsaData+=(boost::lexical_cast<std::string>(lsSeqNo) + "|");
-    corLsaData+=(boost::lexical_cast<std::string>(lifeTime) + "|");
-    corLsaData+=(boost::lexical_cast<std::string>(corRad) + "|");
-    corLsaData+=(boost::lexical_cast<std::string>(corTheta) + "|");
+    corLsaData+=(boost::lexical_cast<std::string>(m_lsSeqNo) + "|");
+    corLsaData+=(boost::lexical_cast<std::string>(m_lifeTime) + "|");
+    corLsaData+=(boost::lexical_cast<std::string>(m_corRad) + "|");
+    corLsaData+=(boost::lexical_cast<std::string>(m_corTheta) + "|");
     return corLsaData;
   }
 
   bool
-  CorLsa::initCorLsaFromContent(string content)
+  CorLsa::initializeFromContent(string content)
   {
     nlsrTokenizer nt(content, "|");
-    origRouter=nt.getNextToken();
-    if(origRouter.empty())
+    m_origRouter=nt.getNextToken();
+    if(m_origRouter.empty())
     {
       return false;
     }
     try
     {
-      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
-      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
-      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
-      corRad=boost::lexical_cast<double>(nt.getNextToken());
-      corTheta=boost::lexical_cast<double>(nt.getNextToken());
+      m_lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
+      m_lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_corRad=boost::lexical_cast<double>(nt.getNextToken());
+      m_corTheta=boost::lexical_cast<double>(nt.getNextToken());
     }
     catch(std::exception &e)
     {
@@ -188,50 +210,50 @@
   AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
                  uint32_t nl ,Adl padl)
   {
-    origRouter=origR;
-    lsType=lst;
-    lsSeqNo=lsn;
-    lifeTime=lt;
-    noLink=nl;
+    m_origRouter=origR;
+    m_lsType=lst;
+    m_lsSeqNo=lsn;
+    m_lifeTime=lt;
+    m_noLink=nl;
     std::list<Adjacent> al=padl.getAdjList();
     for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
     {
       if((*it).getStatus()==1)
       {
-        addAdjacentToLsa((*it));
+        addAdjacent((*it));
       }
     }
   }
 
   string
-  AdjLsa::getAdjLsaKey()
+  AdjLsa::getKey()
   {
     string key;
-    key=origRouter + "/" + boost::lexical_cast<std::string>(2);
+    key=m_origRouter + "/" + boost::lexical_cast<std::string>(2);
     return key;
   }
 
   bool
-  AdjLsa::isLsaContentEqual(AdjLsa& alsa)
+  AdjLsa::isEqual(AdjLsa& alsa)
   {
-    return adl.isAdlEqual(alsa.getAdl());
+    return m_adl.isEqual(alsa.getAdl());
   }
 
 
   string
-  AdjLsa::getAdjLsaData()
+  AdjLsa::getData()
   {
     string adjLsaData;
-    adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(2) + "|"
-               + boost::lexical_cast<std::string>(lsSeqNo) + "|"
-               + boost::lexical_cast<std::string>(lifeTime);
+    adjLsaData=m_origRouter + "|" + boost::lexical_cast<std::string>(2) + "|"
+               + boost::lexical_cast<std::string>(m_lsSeqNo) + "|"
+               + boost::lexical_cast<std::string>(m_lifeTime);
     adjLsaData+="|";
-    adjLsaData+=boost::lexical_cast<std::string>(adl.getAdlSize());
-    std::list<Adjacent> al=adl.getAdjList();
+    adjLsaData+=boost::lexical_cast<std::string>(m_adl.getSize());
+    std::list<Adjacent> al=m_adl.getAdjList();
     for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
     {
       adjLsaData+="|";
-      adjLsaData+=(*it).getAdjacentName();
+      adjLsaData+=(*it).getName();
       adjLsaData+="|";
       adjLsaData+=boost::lexical_cast<std::string>((*it).getConnectingFace());
       adjLsaData+="|";
@@ -241,20 +263,20 @@
   }
 
   bool
-  AdjLsa::initAdjLsaFromContent(string content)
+  AdjLsa::initializeFromContent(string content)
   {
     uint32_t numLink=0;
     nlsrTokenizer nt(content, "|");
-    origRouter=nt.getNextToken();
-    if(origRouter.empty())
+    m_origRouter=nt.getNextToken();
+    if(m_origRouter.empty())
     {
       return false;
     }
     try
     {
-      lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
-      lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
-      lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_lsType=boost::lexical_cast<uint8_t>(nt.getNextToken());
+      m_lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken());
+      m_lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken());
       numLink=boost::lexical_cast<uint32_t>(nt.getNextToken());
     }
     catch(std::exception &e)
@@ -269,7 +291,7 @@
         int connectingFace=boost::lexical_cast<int>(nt.getNextToken());
         double linkCost=boost::lexical_cast<double>(nt.getNextToken());
         Adjacent adjacent(adjName, connectingFace, linkCost, 0, 0);
-        addAdjacentToLsa(adjacent);
+        addAdjacent(adjacent);
       }
       catch( std::exception &e )
       {
@@ -281,7 +303,7 @@
 
 
   void
-  AdjLsa::addNptEntriesForAdjLsa(Nlsr& pnlsr)
+  AdjLsa::addNptEntries(Nlsr& pnlsr)
   {
     if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
     {
@@ -291,7 +313,7 @@
 
 
   void
-  AdjLsa::removeNptEntriesForAdjLsa(Nlsr& pnlsr)
+  AdjLsa::removeNptEntries(Nlsr& pnlsr)
   {
     if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
     {
@@ -316,7 +338,7 @@
     for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
     {
       os<<"    Adjacent "<<i<<": "<<endl;
-      os<<"      Adjacent Name: "<<(*it).getAdjacentName()<<endl;
+      os<<"      Adjacent Name: "<<(*it).getName()<<endl;
       os<<"      Connecting Face: "<<(*it).getConnectingFace()<<endl;
       os<<"      Link Cost: "<<(*it).getLinkCost()<<endl;
     }
diff --git a/src/nlsr_lsa.hpp b/src/nlsr_lsa.hpp
index 06dcbc6..878d688 100644
--- a/src/nlsr_lsa.hpp
+++ b/src/nlsr_lsa.hpp
@@ -16,71 +16,70 @@
   {
   public:
     Lsa()
-      : origRouter()
-      , lsSeqNo()
-      , lifeTime()
-      , lsaExpiringEventId()
+      : m_origRouter()
+      , m_lsSeqNo()
+      , m_lifeTime()
+      , m_expiringEventId()
     {
     }
 
 
     void setLsType(uint8_t lst)
     {
-      lsType=lst;
+      m_lsType=lst;
     }
 
     uint8_t getLsType()
     {
-      return lsType;
+      return m_lsType;
     }
 
     void setLsSeqNo(uint32_t lsn)
     {
-      lsSeqNo=lsn;
+      m_lsSeqNo=lsn;
     }
 
     uint32_t getLsSeqNo()
     {
-      return lsSeqNo;
+      return m_lsSeqNo;
     }
 
     string& getOrigRouter()
     {
-      return origRouter;
+      return m_origRouter;
     }
 
     void setOrigRouter(string& org)
     {
-      origRouter=org;
+      m_origRouter=org;
     }
 
     uint32_t getLifeTime()
     {
-      return lifeTime;
+      return m_lifeTime;
     }
 
     void setLifeTime(uint32_t lt)
     {
-      lifeTime=lt;
+      m_lifeTime=lt;
     }
 
-    void setLsaExpiringEventId(ndn::EventId leei)
+    void setExpiringEventId(ndn::EventId leei)
     {
-      lsaExpiringEventId=leei;
+      m_expiringEventId=leei;
     }
 
-    ndn::EventId getLsaExpiringEventId()
+    ndn::EventId getExpiringEventId()
     {
-      return lsaExpiringEventId;
+      return m_expiringEventId;
     }
 
-
   protected:
-    string origRouter;
-    uint8_t lsType;
-    uint32_t lsSeqNo;
-    uint32_t lifeTime;
-    ndn::EventId lsaExpiringEventId;
+    string m_origRouter;
+    uint8_t m_lsType;
+    uint32_t m_lsSeqNo;
+    uint32_t m_lifeTime;
+    ndn::EventId m_expiringEventId;
   };
 
   class NameLsa:public Lsa
@@ -88,7 +87,7 @@
   public:
     NameLsa()
       : Lsa()
-      , npl()
+      , m_npl()
     {
       setLsType(1);
     }
@@ -97,26 +96,27 @@
 
     Npl& getNpl()
     {
-      return npl;
+      return m_npl;
     }
 
-    void addNameToLsa(string& name)
+    void addName(string& name)
     {
-      npl.insertIntoNpl(name);
+      m_npl.insert(name);
     }
 
-    void removeNameFromLsa(string& name)
+    void removeName(string& name)
     {
-      npl.removeFromNpl(name);
+      m_npl.remove(name);
     }
 
-    string getNameLsaKey();
+    string getKey();
 
-    string getNameLsaData();
-    bool initNameLsaFromContent(string content);
+    string getData();
+    bool initializeFromContent(string content);
+    void writeLog();
 
   private:
-    Npl npl;
+    Npl m_npl;
 
   };
 
@@ -128,7 +128,7 @@
   public:
     AdjLsa()
       : Lsa()
-      , adl()
+      , m_adl()
     {
       setLsType(2);
     }
@@ -137,28 +137,28 @@
            uint32_t nl ,Adl padl);
     Adl& getAdl()
     {
-      return adl;
+      return m_adl;
     }
 
-    void addAdjacentToLsa(Adjacent adj)
+    void addAdjacent(Adjacent adj)
     {
-      adl.insert(adj);
+      m_adl.insert(adj);
     }
-    string getAdjLsaKey();
-    string getAdjLsaData();
-    bool initAdjLsaFromContent(string content);
+    string getKey();
+    string getData();
+    bool initializeFromContent(string content);
     uint32_t getNoLink()
     {
-      return noLink;
+      return m_noLink;
     }
 
-    bool isLsaContentEqual(AdjLsa& alsa);
-    void addNptEntriesForAdjLsa(Nlsr& pnlsr);
-    void removeNptEntriesForAdjLsa(Nlsr& pnlsr);
+    bool isEqual(AdjLsa& alsa);
+    void addNptEntries(Nlsr& pnlsr);
+    void removeNptEntries(Nlsr& pnlsr);
 
   private:
-    uint32_t noLink;
-    Adl adl;
+    uint32_t m_noLink;
+    Adl m_adl;
   };
 
   std::ostream&
@@ -169,22 +169,22 @@
   public:
     CorLsa()
       : Lsa()
-      , corRad(0)
-      , corTheta(0)
+      , m_corRad(0)
+      , m_corTheta(0)
     {
       setLsType(3);
     }
 
     CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
            , double r, double theta);
-    string getCorLsaKey();
-    string getCorLsaData();
-    bool initCorLsaFromContent(string content);
+    string getKey();
+    string getData();
+    bool initializeFromContent(string content);
     double getCorRadius()
     {
-      if ( corRad >= 0 )
+      if ( m_corRad >= 0 )
       {
-        return corRad;
+        return m_corRad;
       }
       else
       {
@@ -194,23 +194,23 @@
 
     void setCorRadius(double cr)
     {
-      corRad=cr;
+      m_corRad=cr;
     }
 
     double getCorTheta()
     {
-      return corTheta;
+      return m_corTheta;
     }
 
     void setCorTheta(double ct)
     {
-      corTheta=ct;
+      m_corTheta=ct;
     }
 
-    bool isLsaContentEqual(CorLsa& clsa);
+    bool isEqual(CorLsa& clsa);
   private:
-    double corRad;
-    double corTheta;
+    double m_corRad;
+    double m_corTheta;
 
   };
 
diff --git a/src/nlsr_lsdb.cpp b/src/nlsr_lsdb.cpp
index 3da115a..7b662e2 100644
--- a/src/nlsr_lsdb.cpp
+++ b/src/nlsr_lsdb.cpp
@@ -2,6 +2,9 @@
 #include<utility>
 #include "nlsr_lsdb.hpp"
 #include "nlsr.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_lsdb.cpp"
 
 namespace nlsr
 {
@@ -17,7 +20,7 @@
   static bool
   nameLsaCompareByKey(NameLsa& nlsa1, string& key)
   {
-    return nlsa1.getNameLsaKey()==key;
+    return nlsa1.getKey()==key;
   }
 
 
@@ -76,11 +79,14 @@
   bool
   Lsdb::installNameLsa(Nlsr& pnlsr, NameLsa &nlsa)
   {
+    src::logger lg;
     int timeToExpire=lsaRefreshTime;
-    std::pair<NameLsa& , bool> chkNameLsa=getNameLsa(nlsa.getNameLsaKey());
+    std::pair<NameLsa& , bool> chkNameLsa=getNameLsa(nlsa.getKey());
     if ( !chkNameLsa.second )
     {
+      BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Adding name lsa";
       addNameLsa(nlsa);
+      nlsa.writeLog();
       printNameLsdb();
       if ( nlsa.getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
       {
@@ -99,17 +105,19 @@
       {
         timeToExpire=nlsa.getLifeTime();
       }
-      nlsa.setLsaExpiringEventId(scheduleNameLsaExpiration( pnlsr,
-                                 nlsa.getNameLsaKey(), nlsa.getLsSeqNo(), timeToExpire));
+      nlsa.setExpiringEventId(scheduleNameLsaExpiration( pnlsr,
+                                 nlsa.getKey(), nlsa.getLsSeqNo(), timeToExpire));
     }
     else
     {
       if ( chkNameLsa.first.getLsSeqNo() < nlsa.getLsSeqNo() )
       {
+        BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Deleting name lsa";
+        chkNameLsa.first.writeLog();
         chkNameLsa.first.setLsSeqNo(nlsa.getLsSeqNo());
         chkNameLsa.first.setLifeTime(nlsa.getLifeTime());
-        chkNameLsa.first.getNpl().sortNpl();
-        nlsa.getNpl().sortNpl();
+        chkNameLsa.first.getNpl().sort();
+        nlsa.getNpl().sort();
         std::list<string> nameToAdd;
         std::set_difference(nlsa.getNpl().getNameList().begin(),
                             nlsa.getNpl().getNameList().end(),
@@ -119,7 +127,7 @@
         for(std::list<string>::iterator it=nameToAdd.begin(); it!=nameToAdd.end();
             ++it)
         {
-          chkNameLsa.first.addNameToLsa((*it));
+          chkNameLsa.first.addName((*it));
           if ( nlsa.getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
           {
             if ( (*it) !=pnlsr.getConfParameter().getRouterPrefix())
@@ -137,7 +145,7 @@
         for(std::list<string>::iterator it=nameToRemove.begin();
             it!=nameToRemove.end(); ++it)
         {
-          chkNameLsa.first.removeNameFromLsa((*it));
+          chkNameLsa.first.removeName((*it));
           if ( nlsa.getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
           {
             if ( (*it) !=pnlsr.getConfParameter().getRouterPrefix())
@@ -151,9 +159,11 @@
           timeToExpire=nlsa.getLifeTime();
         }
         cancelScheduleLsaExpiringEvent(pnlsr,
-                                       chkNameLsa.first.getLsaExpiringEventId());
-        chkNameLsa.first.setLsaExpiringEventId(scheduleNameLsaExpiration( pnlsr,
-                                               nlsa.getNameLsaKey(), nlsa.getLsSeqNo(), timeToExpire));
+                                       chkNameLsa.first.getExpiringEventId());
+        chkNameLsa.first.setExpiringEventId(scheduleNameLsaExpiration( pnlsr,
+                                               nlsa.getKey(), nlsa.getLsSeqNo(), timeToExpire));
+        BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Adding name lsa";
+        chkNameLsa.first.writeLog();
       }
     }
     return true;
@@ -163,7 +173,7 @@
   Lsdb::addNameLsa(NameLsa &nlsa)
   {
     std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
-                                       nameLsdb.end(), bind(nameLsaCompareByKey, _1, nlsa.getNameLsaKey()));
+                                       nameLsdb.end(), bind(nameLsaCompareByKey, _1, nlsa.getKey()));
     if( it == nameLsdb.end())
     {
       nameLsdb.push_back(nlsa);
@@ -175,11 +185,14 @@
   bool
   Lsdb::removeNameLsa(Nlsr& pnlsr, string& key)
   {
+    src::logger lg;
     std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
                                        nameLsdb.end(),
                                        bind(nameLsaCompareByKey, _1, key));
     if ( it != nameLsdb.end() )
     {
+      BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Deleting name lsa";
+      (*it).writeLog();
       if ( (*it).getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix()  )
       {
         pnlsr.getNpt().removeNpte((*it).getOrigRouter(),(*it).getOrigRouter(),pnlsr);
@@ -228,7 +241,7 @@
   static bool
   corLsaCompareByKey(CorLsa& clsa, string& key)
   {
-    return clsa.getCorLsaKey()==key;
+    return clsa.getKey()==key;
   }
 
   bool
@@ -289,7 +302,7 @@
   Lsdb::installCorLsa(Nlsr& pnlsr, CorLsa &clsa)
   {
     int timeToExpire=lsaRefreshTime;
-    std::pair<CorLsa& , bool> chkCorLsa=getCorLsa(clsa.getCorLsaKey());
+    std::pair<CorLsa& , bool> chkCorLsa=getCorLsa(clsa.getKey());
     if ( !chkCorLsa.second )
     {
       addCorLsa(clsa);
@@ -307,7 +320,7 @@
       {
         timeToExpire=clsa.getLifeTime();
       }
-      scheduleCorLsaExpiration(pnlsr,clsa.getCorLsaKey(),
+      scheduleCorLsaExpiration(pnlsr,clsa.getKey(),
                                clsa.getLsSeqNo(), timeToExpire);
     }
     else
@@ -316,7 +329,7 @@
       {
         chkCorLsa.first.setLsSeqNo(clsa.getLsSeqNo());
         chkCorLsa.first.setLifeTime(clsa.getLifeTime());
-        if ( !chkCorLsa.first.isLsaContentEqual(clsa) )
+        if ( !chkCorLsa.first.isEqual(clsa) )
         {
           chkCorLsa.first.setCorRadius(clsa.getCorRadius());
           chkCorLsa.first.setCorTheta(clsa.getCorTheta());
@@ -330,9 +343,9 @@
           timeToExpire=clsa.getLifeTime();
         }
         cancelScheduleLsaExpiringEvent(pnlsr,
-                                       chkCorLsa.first.getLsaExpiringEventId());
-        chkCorLsa.first.setLsaExpiringEventId(scheduleCorLsaExpiration(pnlsr,
-                                              clsa.getCorLsaKey(),
+                                       chkCorLsa.first.getExpiringEventId());
+        chkCorLsa.first.setExpiringEventId(scheduleCorLsaExpiration(pnlsr,
+                                              clsa.getKey(),
                                               clsa.getLsSeqNo(), timeToExpire));
       }
     }
@@ -344,7 +357,7 @@
   {
     std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(),
                                       corLsdb.end(),
-                                      bind(corLsaCompareByKey, _1, clsa.getCorLsaKey()));
+                                      bind(corLsaCompareByKey, _1, clsa.getKey()));
     if( it == corLsdb.end())
     {
       corLsdb.push_back(clsa);
@@ -401,7 +414,7 @@
   static bool
   adjLsaCompareByKey(AdjLsa& alsa, string& key)
   {
-    return alsa.getAdjLsaKey()==key;
+    return alsa.getKey()==key;
   }
 
 
@@ -445,7 +458,7 @@
   {
     std::list<AdjLsa >::iterator it = std::find_if( adjLsdb.begin(),
                                       adjLsdb.end(),
-                                      bind(adjLsaCompareByKey, _1, alsa.getAdjLsaKey()));
+                                      bind(adjLsaCompareByKey, _1, alsa.getKey()));
     if( it == adjLsdb.end())
     {
       adjLsdb.push_back(alsa);
@@ -500,17 +513,17 @@
   Lsdb::installAdjLsa(Nlsr& pnlsr, AdjLsa &alsa)
   {
     int timeToExpire=lsaRefreshTime;
-    std::pair<AdjLsa& , bool> chkAdjLsa=getAdjLsa(alsa.getAdjLsaKey());
+    std::pair<AdjLsa& , bool> chkAdjLsa=getAdjLsa(alsa.getKey());
     if ( !chkAdjLsa.second )
     {
       addAdjLsa(alsa);
-      alsa.addNptEntriesForAdjLsa(pnlsr);
+      alsa.addNptEntries(pnlsr);
       pnlsr.getRoutingTable().scheduleRoutingTableCalculation(pnlsr);
       if(alsa.getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
       {
         timeToExpire=alsa.getLifeTime();
       }
-      scheduleAdjLsaExpiration(pnlsr,alsa.getAdjLsaKey(),
+      scheduleAdjLsaExpiration(pnlsr,alsa.getKey(),
                                alsa.getLsSeqNo(),timeToExpire);
     }
     else
@@ -519,9 +532,9 @@
       {
         chkAdjLsa.first.setLsSeqNo(alsa.getLsSeqNo());
         chkAdjLsa.first.setLifeTime(alsa.getLifeTime());
-        if ( !	chkAdjLsa.first.isLsaContentEqual(alsa))
+        if ( !	chkAdjLsa.first.isEqual(alsa))
         {
-          chkAdjLsa.first.getAdl().resetAdl();
+          chkAdjLsa.first.getAdl().reset();
           chkAdjLsa.first.getAdl().addAdjacentsFromAdl(alsa.getAdl());
           pnlsr.getRoutingTable().scheduleRoutingTableCalculation(pnlsr);
         }
@@ -530,9 +543,9 @@
           timeToExpire=alsa.getLifeTime();
         }
         cancelScheduleLsaExpiringEvent(pnlsr,
-                                       chkAdjLsa.first.getLsaExpiringEventId());
-        chkAdjLsa.first.setLsaExpiringEventId(scheduleAdjLsaExpiration(pnlsr,
-                                              alsa.getAdjLsaKey(), alsa.getLsSeqNo(),timeToExpire));
+                                       chkAdjLsa.first.getExpiringEventId());
+        chkAdjLsa.first.setExpiringEventId(scheduleAdjLsaExpiration(pnlsr,
+                                              alsa.getKey(), alsa.getLsSeqNo(),timeToExpire));
       }
     }
     return true;
@@ -562,7 +575,7 @@
                                       bind(adjLsaCompareByKey, _1, key));
     if ( it != adjLsdb.end() )
     {
-      (*it).removeNptEntriesForAdjLsa(pnlsr);
+      (*it).removeNptEntries(pnlsr);
       adjLsdb.erase(it);
       return true;
     }
@@ -613,9 +626,14 @@
       {
         if(chkNameLsa.first.getOrigRouter() == thisRouterPrefix )
         {
+          src::logger lg;
+          BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Deleting name lsa";
+          chkNameLsa.first.writeLog();
           cout<<"Own Name LSA, so refreshing name LSA"<<endl;
           chkNameLsa.first.setLsSeqNo(chkNameLsa.first.getLsSeqNo()+1);
           pnlsr.getSm().setNameLsaSeq(chkNameLsa.first.getLsSeqNo());
+          BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Adding name lsa";
+          chkNameLsa.first.writeLog();
           // publish routing update
           string lsaPrefix=pnlsr.getConfParameter().getChronosyncLsaPrefix()
                            + pnlsr.getConfParameter().getRouterPrefix();
diff --git a/src/nlsr_npl.cpp b/src/nlsr_npl.cpp
index d8b2087..e6cd819 100644
--- a/src/nlsr_npl.cpp
+++ b/src/nlsr_npl.cpp
@@ -2,6 +2,9 @@
 #include<algorithm>
 
 #include "nlsr_npl.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_npl.cpp"
 
 namespace nlsr
 {
@@ -23,43 +26,43 @@
   }
 
   int
-  Npl::insertIntoNpl(string& name)
+  Npl::insert(string& name)
   {
-    std::list<string >::iterator it = std::find_if( nameList.begin(),
-                                      nameList.end(),
+    std::list<string >::iterator it = std::find_if( m_nameList.begin(),
+                                      m_nameList.end(),
                                       bind(&nameCompare, _1 , name));
-    if( it != nameList.end() )
+    if( it != m_nameList.end() )
     {
       return -1;
     }
-    nameList.push_back(name);
+    m_nameList.push_back(name);
     return 0;
   }
 
   int
-  Npl::removeFromNpl(string& name)
+  Npl::remove(string& name)
   {
-    std::list<string >::iterator it = std::find_if( nameList.begin(),
-                                      nameList.end(),
+    std::list<string >::iterator it = std::find_if( m_nameList.begin(),
+                                      m_nameList.end(),
                                       bind(&nameCompare, _1 , name));
-    if( it != nameList.end() )
+    if( it != m_nameList.end() )
     {
-      nameList.erase(it);
+      m_nameList.erase(it);
     }
     return -1;
   }
 
   void
-  Npl::sortNpl()
+  Npl::sort()
   {
-    nameList.sort();
+    m_nameList.sort();
   }
 
   void
-  Npl::printNpl()
+  Npl::print()
   {
     int i=1;
-    for( std::list<string>::iterator it=nameList.begin(); it != nameList.end();
+    for( std::list<string>::iterator it=m_nameList.begin(); it != m_nameList.end();
          it++)
     {
       cout<<"Name "<<i<<" : "<<(*it)<<endl;
diff --git a/src/nlsr_npl.hpp b/src/nlsr_npl.hpp
index dd1bafa..b69b352 100644
--- a/src/nlsr_npl.hpp
+++ b/src/nlsr_npl.hpp
@@ -17,21 +17,21 @@
     Npl();
     ~Npl();
 
-    int insertIntoNpl(string& name);
-    int removeFromNpl(string& name);
-    void sortNpl();
-    int getNplSize()
+    int insert(string& name);
+    int remove(string& name);
+    void sort();
+    int getSize()
     {
-      return nameList.size();
+      return m_nameList.size();
     }
     std::list<string>& getNameList()
     {
-      return nameList;
+      return m_nameList;
     }
-    void printNpl();
+    void print();
 
   private:
-    std::list<string> nameList;
+    std::list<string> m_nameList;
 
   };
 
diff --git a/src/nlsr_sm.cpp b/src/nlsr_sm.cpp
index efc7614..e44c433 100644
--- a/src/nlsr_sm.cpp
+++ b/src/nlsr_sm.cpp
@@ -6,6 +6,9 @@
 #include <unistd.h>
 
 #include "nlsr_sm.hpp"
+#include "utility/nlsr_logger.hpp"
+
+#define THIS_FILE "nlsr_sm.cpp"
 
 namespace nlsr
 {
@@ -15,41 +18,41 @@
   void
   SequencingManager::splittSequenceNo(uint64_t seqNo)
   {
-    combinedSeqNo=seqNo;
-    adjLsaSeq = (combinedSeqNo & 0xFFFFF);
-    corLsaSeq = ((combinedSeqNo >> 20) & 0xFFFFF);
-    nameLsaSeq = ((combinedSeqNo >> 40) & 0xFFFFF);
+    m_combinedSeqNo=seqNo;
+    m_adjLsaSeq = (m_combinedSeqNo & 0xFFFFF);
+    m_corLsaSeq = ((m_combinedSeqNo >> 20) & 0xFFFFF);
+    m_nameLsaSeq = ((m_combinedSeqNo >> 40) & 0xFFFFF);
   }
 
   void
   SequencingManager::combineSequenceNo()
   {
-    combinedSeqNo=0;
-    combinedSeqNo = combinedSeqNo | adjLsaSeq;
-    combinedSeqNo = combinedSeqNo | (corLsaSeq<<20);
-    combinedSeqNo = combinedSeqNo | (nameLsaSeq<<40);
+    m_combinedSeqNo=0;
+    m_combinedSeqNo = m_combinedSeqNo | m_adjLsaSeq;
+    m_combinedSeqNo = m_combinedSeqNo | (m_corLsaSeq<<20);
+    m_combinedSeqNo = m_combinedSeqNo | (m_nameLsaSeq<<40);
   }
 
   void
   SequencingManager::writeSeqNoToFile()
   {
-    std::ofstream outputFile(seqFileNameWithPath.c_str(),ios::binary);
-    outputFile<<combinedSeqNo;
+    std::ofstream outputFile(m_seqFileNameWithPath.c_str(),ios::binary);
+    outputFile<<m_combinedSeqNo;
     outputFile.close();
   }
 
   void
   SequencingManager::initiateSeqNoFromFile()
   {
-    cout<<"Seq File Name: "<< seqFileNameWithPath<<endl;
-    std::ifstream inputFile(seqFileNameWithPath.c_str(),ios::binary);
+    cout<<"Seq File Name: "<< m_seqFileNameWithPath<<endl;
+    std::ifstream inputFile(m_seqFileNameWithPath.c_str(),ios::binary);
     if ( inputFile.good() )
     {
-      inputFile>>combinedSeqNo;
-      splittSequenceNo(combinedSeqNo);
-      adjLsaSeq+=10;
-      corLsaSeq+=10;
-      nameLsaSeq+=10;
+      inputFile>>m_combinedSeqNo;
+      splittSequenceNo(m_combinedSeqNo);
+      m_adjLsaSeq+=10;
+      m_corLsaSeq+=10;
+      m_nameLsaSeq+=10;
       combineSequenceNo();
       inputFile.close();
     }
@@ -62,12 +65,12 @@
   void
   SequencingManager::setSeqFileName(string filePath)
   {
-    seqFileNameWithPath=filePath;
-    if( seqFileNameWithPath.empty() )
+    m_seqFileNameWithPath=filePath;
+    if( m_seqFileNameWithPath.empty() )
     {
-      seqFileNameWithPath=getUserHomeDirectory();
+      m_seqFileNameWithPath=getUserHomeDirectory();
     }
-    seqFileNameWithPath=seqFileNameWithPath+"/nlsrSeqNo.txt";
+    m_seqFileNameWithPath=m_seqFileNameWithPath+"/nlsrSeqNo.txt";
   }
 
   string
diff --git a/src/nlsr_sm.hpp b/src/nlsr_sm.hpp
index d1cbb23..4861009 100644
--- a/src/nlsr_sm.hpp
+++ b/src/nlsr_sm.hpp
@@ -14,11 +14,11 @@
   {
   public:
     SequencingManager()
-      : nameLsaSeq(0)
-      , adjLsaSeq(0)
-      , corLsaSeq(0)
-      , combinedSeqNo(0)
-      , seqFileNameWithPath()
+      : m_nameLsaSeq(0)
+      , m_adjLsaSeq(0)
+      , m_corLsaSeq(0)
+      , m_combinedSeqNo(0)
+      , m_seqFileNameWithPath()
     {
     }
 
@@ -29,48 +29,48 @@
 
     SequencingManager(uint64_t nlsn, uint64_t alsn, uint64_t clsn)
     {
-      nameLsaSeq=nlsn;
-      adjLsaSeq=alsn;
-      corLsaSeq=clsn;
+      m_nameLsaSeq=nlsn;
+      m_adjLsaSeq=alsn;
+      m_corLsaSeq=clsn;
       combineSequenceNo();
     }
 
     uint64_t getNameLsaSeq() const
     {
-      return nameLsaSeq;
+      return m_nameLsaSeq;
     }
 
     void setNameLsaSeq(uint64_t nlsn)
     {
-      nameLsaSeq=nlsn;
+      m_nameLsaSeq=nlsn;
       combineSequenceNo();
     }
 
     uint64_t getAdjLsaSeq() const
     {
-      return adjLsaSeq;
+      return m_adjLsaSeq;
     }
 
     void setAdjLsaSeq(uint64_t alsn)
     {
-      adjLsaSeq=alsn;
+      m_adjLsaSeq=alsn;
       combineSequenceNo();
     }
 
     uint64_t getCorLsaSeq() const
     {
-      return corLsaSeq;
+      return m_corLsaSeq;
     }
 
     void setCorLsaSeq(uint64_t clsn)
     {
-      corLsaSeq=clsn;
+      m_corLsaSeq=clsn;
       combineSequenceNo();
     }
 
     uint64_t getCombinedSeqNo() const
     {
-      return combinedSeqNo;
+      return m_combinedSeqNo;
     }
 
     void writeSeqNoToFile();
@@ -84,11 +84,11 @@
 
 
   private:
-    uint64_t nameLsaSeq;
-    uint64_t adjLsaSeq;
-    uint64_t corLsaSeq;
-    uint64_t combinedSeqNo;
-    string seqFileNameWithPath;
+    uint64_t m_nameLsaSeq;
+    uint64_t m_adjLsaSeq;
+    uint64_t m_corLsaSeq;
+    uint64_t m_combinedSeqNo;
+    string m_seqFileNameWithPath;
   };
 
 
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);
 
 }
 
diff --git a/src/security/nlsr_cert_store.cpp b/src/security/nlsr_cert_store.cpp
index 897d44a..fa84ad9 100644
--- a/src/security/nlsr_cert_store.cpp
+++ b/src/security/nlsr_cert_store.cpp
@@ -4,6 +4,8 @@
 #include "nlsr_wle.hpp"
 #include "nlsr_km.hpp"
 
+#define THIS_FILE "nlsr_cert_store.cpp"
+
 namespace nlsr
 {
   static bool
@@ -36,7 +38,7 @@
     ndn::Name tmpName(respCertName);
     respCertName=tmpName.getPrefix(-1).toUri();
     std::pair<WaitingListEntry, bool> chkWle=
-                              waitingList.getWaitingListEntry(respCertName);
+                              m_waitingList.getWaitingListEntry(respCertName);
     if( chkWle.second )
     {
       std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> sc=
@@ -62,7 +64,7 @@
     }
     
     //remove that entry from waiting list
-    waitingList.removeFromWaitingList(respCertName);
+    m_waitingList.remove(respCertName);
   }
   
   void
@@ -75,7 +77,7 @@
     else
     {
       ndn::SignatureSha256WithRsa signature(ncse.getCert()->getSignature());
-      waitingList.addtoWaitingList(signature.getKeyLocator().getName().toUri(), 
+      m_waitingList.add(signature.getKeyLocator().getName().toUri(), 
                                              ncse.getCert()->getName().toUri());
     }
   }
@@ -84,20 +86,20 @@
   NlsrCertificateStore::addCertificate(NlsrCertificateStoreEntry & ncse)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompare, _1, ncse));
-    if(it == certTable.end())
+    if(it == m_certTable.end())
     {
-      certTable.push_back(ncse);
+      m_certTable.push_back(ncse);
       updateWaitingList(ncse);
       return true;
     }
-    else if( it !=  certTable.end() )
+    else if( it !=  m_certTable.end() )
     {
       if ( (*it).getCertSeqNum() < ncse.getCertSeqNum() )
       {
-        certTable.erase(it);
-        certTable.push_back(ncse);
+        m_certTable.erase(it);
+        m_certTable.push_back(ncse);
         updateWaitingList(ncse);
         return true;
       }
@@ -117,9 +119,9 @@
   NlsrCertificateStore::getCertificateSeqNum(std::string certName)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it == certTable.end())
+    if(it == m_certTable.end())
     {
       return std::make_pair(0,false);
     }
@@ -133,9 +135,9 @@
                                                                 bool isVerified)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it != certTable.end())
+    if(it != m_certTable.end())
     {
       it->setIsSignerVerified(true);
     }
@@ -145,9 +147,9 @@
   NlsrCertificateStore::getCertificateIsVerified( std::string certName )
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it != certTable.end())
+    if(it != m_certTable.end())
     {
       return it->getIsSignerVerified();
     }
@@ -159,9 +161,9 @@
   NlsrCertificateStore::getCertificateFromStore(const std::string certName)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it == certTable.end())
+    if(it == m_certTable.end())
     {
       ndn::shared_ptr<ndn::IdentityCertificate> cert=
                                     ndn::make_shared<ndn::IdentityCertificate>();
@@ -175,9 +177,9 @@
     const std::string certName, int checkSeqNum)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it == certTable.end())
+    if(it == m_certTable.end())
     {
       ndn::shared_ptr<ndn::IdentityCertificate> cert=
         ndn::make_shared<ndn::IdentityCertificate>();
@@ -198,9 +200,9 @@
       int checkSeqNo)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it != certTable.end())
+    if(it != m_certTable.end())
     {
       return (*it).getCertSeqNum() < checkSeqNo ;
     }
@@ -211,24 +213,24 @@
   NlsrCertificateStore::removeCertificateFromStroe(const std::string certName)
   {
     std::list<NlsrCertificateStoreEntry>::iterator it =
-      std::find_if( certTable.begin(), certTable.end(),
+      std::find_if( m_certTable.begin(), m_certTable.end(),
                     bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
-    if(it != certTable.end())
+    if(it != m_certTable.end())
     {
-      certTable.erase(it);
+      m_certTable.erase(it);
       return true;
     }
     return false;
   }
 
   void
-  NlsrCertificateStore::printCertStore()
+  NlsrCertificateStore::print()
   {
     std::list<NlsrCertificateStoreEntry>::iterator it;
-    for(it=certTable.begin(); it!=certTable.end(); ++it)
+    for(it=m_certTable.begin(); it!=m_certTable.end(); ++it)
     {
       std::cout<<(*it)<<std::endl;
     }
-    std::cout<<waitingList<<std::endl;
+    std::cout<<m_waitingList<<std::endl;
   }
 }
diff --git a/src/security/nlsr_cert_store.hpp b/src/security/nlsr_cert_store.hpp
index d9c9b64..2ef4513 100644
--- a/src/security/nlsr_cert_store.hpp
+++ b/src/security/nlsr_cert_store.hpp
@@ -12,11 +12,11 @@
   {
   public:
     NlsrCertificateStore()
-        : certTable()
-        , waitingList()
+        : m_certTable()
+        , m_waitingList()
     {}
 
-    bool addCertificate(NlsrCertificateStoreEntry & ncse);
+    bool addCertificate(NlsrCertificateStoreEntry& ncse);
     bool addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
                         , uint32_t csn, bool isv);
     std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
@@ -26,7 +26,7 @@
     bool removeCertificateFromStroe(const std::string certName);
     bool isCertificateNewInStore(const std::string certName, int checkSeqNo);
     std::pair<uint32_t, bool> getCertificateSeqNum(std::string certName);
-    void printCertStore();
+    void print();
     void setCertificateIsVerified(std::string certName, bool isVerified);
     bool getCertificateIsVerified(std::string certName);
   private:
@@ -34,8 +34,8 @@
     void updateWaitingList(std::string respCertName);
     
   private:
-    std::list<NlsrCertificateStoreEntry> certTable;
-    WaitingList waitingList;
+    std::list<NlsrCertificateStoreEntry> m_certTable;
+    WaitingList m_waitingList;
   };
 }
 
diff --git a/src/security/nlsr_cse.cpp b/src/security/nlsr_cse.cpp
index f2f5f06..91c0150 100644
--- a/src/security/nlsr_cse.cpp
+++ b/src/security/nlsr_cse.cpp
@@ -1,6 +1,8 @@
 #include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp>
 #include "nlsr_cse.hpp"
 
+#define THIS_FILE "nlsr_cse.cpp"
+
 namespace nlsr
 {
   std::ostream&
diff --git a/src/security/nlsr_cse.hpp b/src/security/nlsr_cse.hpp
index f91e9e2..238d511 100644
--- a/src/security/nlsr_cse.hpp
+++ b/src/security/nlsr_cse.hpp
@@ -11,52 +11,52 @@
   {
   public:
     NlsrCertificateStoreEntry()
-      : cert(ndn::make_shared<ndn::IdentityCertificate>())
-      , certSeqNum(0)
-      , isSignerVerified(false)
+      : m_cert(ndn::make_shared<ndn::IdentityCertificate>())
+      , m_certSeqNum(0)
+      , m_isSignerVerified(false)
     {}
 
     NlsrCertificateStoreEntry(ndn::shared_ptr<ndn::IdentityCertificate> pcert
                               , uint32_t csn, bool isv)
-      : cert(pcert)
-      , certSeqNum(csn)
-      , isSignerVerified(isv)
+      : m_cert(pcert)
+      , m_certSeqNum(csn)
+      , m_isSignerVerified(isv)
     {}
 
     ndn::shared_ptr<ndn::IdentityCertificate> getCert() const
     {
-      return cert;
+      return m_cert;
     }
 
     void setCert(ndn::shared_ptr<ndn::IdentityCertificate> pcert)
     {
-      cert=pcert;
+      m_cert=pcert;
     }
 
     uint32_t getCertSeqNum() const
     {
-      return certSeqNum;
+      return m_certSeqNum;
     }
 
     void setCertSeqNum(uint32_t csn)
     {
-      certSeqNum=csn;
+      m_certSeqNum=csn;
     }
 
     bool getIsSignerVerified() const
     {
-      return isSignerVerified;
+      return m_isSignerVerified;
     }
 
     void setIsSignerVerified(bool isv)
     {
-      isSignerVerified=isv;
+      m_isSignerVerified=isv;
     }
 
   private:
-    ndn::shared_ptr<ndn::IdentityCertificate> cert;
-    uint32_t certSeqNum;
-    bool isSignerVerified;
+    ndn::shared_ptr<ndn::IdentityCertificate> m_cert;
+    uint32_t m_certSeqNum;
+    bool m_isSignerVerified;
   };
   /* Debugging Purpose */
   std::ostream&
diff --git a/src/security/nlsr_km.cpp b/src/security/nlsr_km.cpp
index 183e934..d357795 100644
--- a/src/security/nlsr_km.cpp
+++ b/src/security/nlsr_km.cpp
@@ -6,17 +6,19 @@
 #include "nlsr_km.hpp"
 #include "nlsr.hpp"
 
+#define THIS_FILE "nlsr_km.cpp"
+
 namespace nlsr
 {
   bool
-  KeyManager::initKeyManager(ConfParameter &cp)
+  KeyManager::initialize(ConfParameter &cp)
   {
     initCertSeqFromFile(cp.getSeqFileDir());
     if( !loadAllCertificates(cp.getCertDir()) )
     {
       return false;
     }
-    nlsrRootKeyPrefix=cp.getRootKeyPrefix();
+    m_nlsrRootKeyPrefix=cp.getRootKeyPrefix();
     string processIdentityName(cp.getRootKeyPrefix());
     processIdentityName += "/";
     processIdentityName += cp.getSiteName();
@@ -26,22 +28,22 @@
     processIdentityName += cp.getRouterName();
     ndn::Name ri(processIdentityName);
     std::cout<<"Router Identity: "<<ri.toUri()<<std::endl;
-    routerIdentity=ri;
+    m_routerIdentity=ri;
     processIdentityName += "/";
     processIdentityName += "nlsr";
     cout<<"Proces Identity Name: "<<processIdentityName<<endl;
     ndn::Name identityName(processIdentityName);
-    processIdentity=identityName;
-    ndn::KeyChain::deleteIdentity(processIdentity);
-    processCertName = ndn::KeyChain::createIdentity(processIdentity);
-    cout<<"Certificate Name: "<<processCertName.toUri()<<endl;
-    processKeyName=processCertName.getPrefix(-2);
-    cout<<"Key Name: "<<processKeyName.toUri()<<endl;
+    m_processIdentity=identityName;
+    ndn::KeyChain::deleteIdentity(m_processIdentity);
+    m_processCertName = ndn::KeyChain::createIdentity(m_processIdentity);
+    cout<<"Certificate Name: "<<m_processCertName.toUri()<<endl;
+    m_processKeyName=m_processCertName.getPrefix(-2);
+    cout<<"Key Name: "<<m_processKeyName.toUri()<<endl;
     ndn::shared_ptr<ndn::IdentityCertificate> cert = 
-                                                getCertificate(processCertName);
-    signByIdentity(*(cert),routerIdentity);
-    certStore.addCertificate(cert, certSeqNo, true);
-    certStore.printCertStore();
+                                                getCertificate(m_processCertName);
+    signByIdentity(*(cert),m_routerIdentity);
+    m_certStore.addCertificate(cert, m_certSeqNo, true);
+    m_certStore.print();
     return true;
   }
 
@@ -70,35 +72,35 @@
         ndn::io::load<ndn::IdentityCertificate>(inputFile, ndn::io::BASE_64);
       ndn::Name certName=cert->getName();
       switch(keyType)
-      {
+        {
         case KEY_TYPE_ROOT:
-          certStore.addCertificate(cert, 10, true);
-          rootCertName=certName;
-          std::cout<<"Root Cert: "<<rootCertName<<std::endl;
+          m_certStore.addCertificate(cert, 10, true);
+          m_rootCertName=certName;
+          std::cout<<"Root Cert: "<<m_rootCertName<<std::endl;
           break;
         case KEY_TYPE_SITE:
-          certStore.addCertificate(cert, 10, true);
-          siteCertName=certName;
-          std::cout<<"Site Cert: "<<siteCertName<<std::endl;
+          m_certStore.addCertificate(cert, 10, true);
+          m_siteCertName=certName;
+          std::cout<<"Site Cert: "<<m_siteCertName<<std::endl;
           break;
         case KEY_TYPE_OPERATOR:
-          certStore.addCertificate(cert, 10, true);
-          opCertName=certName;
-          std::cout<<"Operator Cert: "<<opCertName<<std::endl;
+          m_certStore.addCertificate(cert, 10, true);
+          m_opCertName=certName;
+          std::cout<<"Operator Cert: "<<m_opCertName<<std::endl;
           break;
         case KEY_TYPE_ROUTER:
-          certStore.addCertificate(cert, certSeqNo, true);
-          routerCertName=certName;
-          std::cout<<"Router Cert: "<<routerCertName<<std::endl;
+          m_certStore.addCertificate(cert, m_certSeqNo, true);
+          m_routerCertName=certName;
+          std::cout<<"Router Cert: "<<m_routerCertName<<std::endl;
           break;
         case KEY_TYPE_PROCESS:
-          certStore.addCertificate(cert, certSeqNo, true);
-          processCertName=certName;
-          std::cout<<"Process Cert: "<<processCertName<<std::endl;
+          m_certStore.addCertificate(cert, m_certSeqNo, true);
+          m_processCertName=certName;
+          std::cout<<"Process Cert: "<<m_processCertName<<std::endl;
           break;
         default:
           break;
-      }
+        }
       return true;
     }
     catch(std::exception& e)
@@ -111,65 +113,65 @@
   ndn::Name
   KeyManager::getProcessCertName()
   {
-    return processCertName;
+    return m_processCertName;
   }
 
   ndn::Name
   KeyManager::getRouterCertName()
   {
-    return routerCertName;
+    return m_routerCertName;
   }
 
   ndn::Name
   KeyManager::getOperatorCertName()
   {
-    return opCertName;
+    return m_opCertName;
   }
 
   ndn::Name
   KeyManager::getSiteCertName()
   {
-    return siteCertName;
+    return m_siteCertName;
   }
 
   ndn::Name
   KeyManager::getRootCertName()
   {
-    return rootCertName;
+    return m_rootCertName;
   }
 
   uint32_t
   KeyManager::getCertSeqNo()
   {
-    return certSeqNo;
+    return m_certSeqNo;
   }
 
   void
   KeyManager::setCerSeqNo(uint32_t csn)
   {
-    certSeqNo=csn;
+    m_certSeqNo=csn;
   }
 
   void
   KeyManager::initCertSeqFromFile(string certSeqFileDir)
   {
-    certSeqFileNameWithPath=certSeqFileDir;
-    if( certSeqFileNameWithPath.empty() )
+    m_certSeqFileNameWithPath=certSeqFileDir;
+    if( m_certSeqFileNameWithPath.empty() )
     {
       SequencingManager sm;
-      certSeqFileNameWithPath=sm.getUserHomeDirectory();
+      m_certSeqFileNameWithPath=sm.getUserHomeDirectory();
     }
-    certSeqFileNameWithPath += "/nlsrCertSeqNo.txt";
-    cout<<"Key Seq File Name: "<< certSeqFileNameWithPath<<endl;
-    std::ifstream inputFile(certSeqFileNameWithPath.c_str(),ios::binary);
+    m_certSeqFileNameWithPath += "/nlsrCertSeqNo.txt";
+    cout<<"Key Seq File Name: "<< m_certSeqFileNameWithPath<<endl;
+    std::ifstream inputFile(m_certSeqFileNameWithPath.c_str(),ios::binary);
     if ( inputFile.good() )
     {
-      inputFile>>certSeqNo;
-      certSeqNo++;
+      inputFile>>m_certSeqNo;
+      m_certSeqNo++;
     }
     else
     {
-      certSeqNo=1;
+      m_certSeqNo=1;
     }
     writeCertSeqToFile();
   }
@@ -177,40 +179,40 @@
   void
   KeyManager::writeCertSeqToFile()
   {
-    std::ofstream outputFile(certSeqFileNameWithPath.c_str(),ios::binary);
-    outputFile<<certSeqNo;
+    std::ofstream outputFile(m_certSeqFileNameWithPath.c_str(),ios::binary);
+    outputFile<<m_certSeqNo;
     outputFile.close();
   }
 
   bool
   KeyManager::isNewCertificate(std::string certName, int checkSeqNum)
   {
-    return certStore.isCertificateNewInStore(certName,checkSeqNum);
+    return m_certStore.isCertificateNewInStore(certName,checkSeqNum);
   }
 
   std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
   KeyManager::getCertificateFromStore(const std::string certName, int checkSeqNum)
   {
-    return certStore.getCertificateFromStore(certName, checkSeqNum);
+    return m_certStore.getCertificateFromStore(certName, checkSeqNum);
   }
 
   std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
   KeyManager::getCertificateFromStore(const std::string certName)
   {
-    return certStore.getCertificateFromStore(certName);
+    return m_certStore.getCertificateFromStore(certName);
   }
 
   bool
   KeyManager::addCertificate(ndn::shared_ptr<ndn::IdentityCertificate> pcert
                              , uint32_t csn, bool isv)
   {
-    return certStore.addCertificate(pcert, csn, isv);
+    return m_certStore.addCertificate(pcert, csn, isv);
   }
   
   std::pair<uint32_t, bool> 
   KeyManager::getCertificateSeqNum(std::string certName)
   {
-    return certStore.getCertificateSeqNum(certName);
+    return m_certStore.getCertificateSeqNum(certName);
   }
 
   nlsrKeyType
@@ -221,7 +223,7 @@
     std::string opHandle("O.Start");
     std::string routerHandle("R.Start");
     std::string processHandle("nlsr");
-    if ( nt.getTokenString(0,nt.getTokenPosition(KEY)-1) == nlsrRootKeyPrefix)
+    if ( nt.getTokenString(0,nt.getTokenPosition(KEY)-1) == m_nlsrRootKeyPrefix)
     {
       return KEY_TYPE_ROOT;
     }
@@ -249,7 +251,7 @@
   KeyManager::getRouterName(const std::string name)
   {
     std::string routerName;
-    std::string rkp(nlsrRootKeyPrefix);
+    std::string rkp(m_nlsrRootKeyPrefix);
     nlsrTokenizer ntRkp(rkp,"/");
     nlsrTokenizer nt(name,"/");
     std::string KEY("KEY");
@@ -295,7 +297,7 @@
   {
     std::string siteName;
     std::string routerName;
-    std::string rkp(nlsrRootKeyPrefix);
+    std::string rkp(m_nlsrRootKeyPrefix);
     nlsrTokenizer ntRkp(rkp,"/");
     nlsrTokenizer nt(name,"/");
     std::string KEY("KEY");
@@ -324,7 +326,7 @@
   {
     std::string rName;
     nlsrTokenizer nt(name,"/");
-    std::string rkp(nlsrRootKeyPrefix);
+    std::string rkp(m_nlsrRootKeyPrefix);
     nlsrTokenizer ntRkp(rkp,"/");
     rName=nt.getTokenString(0,ntRkp.getTokenNumber()-1);
     return rName;
@@ -356,37 +358,37 @@
       }
       
       std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee=
-                             certStore.getCertificateFromStore(signingCertName);
+                             m_certStore.getCertificateFromStore(signingCertName);
       
       if( signee.second )
       {
         switch(paketCertType)
-        {
+          {
           case KEY_TYPE_ROOT:
-            return ((getRootName(packetName) == nlsrRootKeyPrefix) &&
+            return ((getRootName(packetName) == m_nlsrRootKeyPrefix) &&
                      verifySignature(packet,signee.first->getPublicKeyInfo()));
             break;
           case KEY_TYPE_SITE:
             return ((getRootName(packetName) == getRootName(signingCertName)) &&
                       verifySignature(packet,signee.first->getPublicKeyInfo()) &&
-                      certStore.getCertificateIsVerified(signingCertName));                   
+                      m_certStore.getCertificateIsVerified(signingCertName));                   
             break;
           case KEY_TYPE_OPERATOR:
             return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
                      verifySignature(packet,signee.first->getPublicKeyInfo()) &&
-                     certStore.getCertificateIsVerified(signingCertName)); 
+                     m_certStore.getCertificateIsVerified(signingCertName)); 
             break;
           case KEY_TYPE_ROUTER:
             return ((getSiteName(packetName) == getSiteName(signingCertName)) &&
                      verifySignature(packet,signee.first->getPublicKeyInfo()) &&
-                     certStore.getCertificateIsVerified(signingCertName));
+                     m_certStore.getCertificateIsVerified(signingCertName));
             break;
           case KEY_TYPE_PROCESS:
             return ((getRouterName(packetName) == getRouterName(signingCertName)) &&
                      verifySignature(packet,signee.first->getPublicKeyInfo()) &&
-                     certStore.getCertificateIsVerified(signingCertName));
+                     m_certStore.getCertificateIsVerified(signingCertName));
             break;
-        }
+          }
       }
       else
       {
diff --git a/src/security/nlsr_km.hpp b/src/security/nlsr_km.hpp
index 7d75fb2..291d55c 100644
--- a/src/security/nlsr_km.hpp
+++ b/src/security/nlsr_km.hpp
@@ -37,35 +37,35 @@
     typedef SecTpm::Error TpmError;
   public:
     KeyManager()
-      : certSeqNo(1)
-      , certStore()
-      , nlsrRootKeyPrefix()
+      : m_certSeqNo(1)
+      , m_certStore()
+      , m_nlsrRootKeyPrefix()
     {
     }
 
-    bool initKeyManager(ConfParameter &cp);
+    bool initialize(ConfParameter &cp);
 
 
 
     void
     checkPolicy (const ndn::Data& data,
                  int stepCount,
-                 const ndn::OnDataValidated &onValidated,
-                 const ndn::OnDataValidationFailed &onValidationFailed,
-                 std::vector<ndn::shared_ptr<ndn::ValidationRequest> > &nextSteps)
+                 const ndn::OnDataValidated& onValidated,
+                 const ndn::OnDataValidationFailed& onValidationFailed,
+                 std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
     {}
 
     void
     checkPolicy (const ndn::Interest& interest,
                  int stepCount,
-                 const ndn::OnInterestValidated &onValidated,
-                 const ndn::OnInterestValidationFailed &onValidationFailed,
-                 std::vector<ndn::shared_ptr<ndn::ValidationRequest> > &nextSteps)
+                 const ndn::OnInterestValidated& onValidated,
+                 const ndn::OnInterestValidationFailed& onValidationFailed,
+                 std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
     {}
 
     void signData(ndn::Data& data)
     {
-      ndn::KeyChain::signByIdentity(data,processIdentity);
+      ndn::KeyChain::signByIdentity(data,m_processIdentity);
     }
 
     template<typename T>
@@ -83,7 +83,7 @@
     ndn::shared_ptr<ndn::IdentityCertificate>
     getCertificate()
     {
-      return getCertificate(processCertName);
+      return getCertificate(m_processCertName);
     }
 
     ndn::Name
@@ -127,8 +127,8 @@
         certificateName.append("KEY").append(
           keyName.get(-1)).append("ID-CERT").appendVersion();
         certificate->setName(certificateName);
-        certificate->setNotBefore(ndn::getNow());
-        certificate->setNotAfter(ndn::getNow() + 31536000 /* 1 year*/);
+        certificate->setNotBefore(ndn::time::system_clock::now());
+        certificate->setNotAfter(ndn::time::system_clock::now() + ndn::time::days(7300) /* 1 year*/);
         certificate->setPublicKeyInfo(*pubKey);
         certificate->addSubjectDescription(
           ndn::CertificateSubjectDescription("2.5.4.41",
@@ -156,7 +156,7 @@
 
     void printCertStore()
     {
-      certStore.printCertStore();
+      m_certStore.print();
     }
 
   private:
@@ -168,14 +168,14 @@
       std::string signingCertName=signature.getKeyLocator().getName().toUri();
       std::string packetName=packet.getName().toUri();
       std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> signee=
-        certStore.getCertificateFromStore(signingCertName);
+        m_certStore.getCertificateFromStore(signingCertName);
       if( signee.second )
       {
         std::string routerNameFromPacketName=getRouterName(packetName);
         std::string routerNameFromCertName=getRouterName(signingCertName);
         return ( (routerNameFromPacketName== routerNameFromCertName) &&
                  verifySignature(packet, signee.first->getPublicKeyInfo()) &&
-                 certStore.getCertificateIsVerified(signingCertName));
+                 m_certStore.getCertificateIsVerified(signingCertName));
       }
       return false;
     }
@@ -230,18 +230,18 @@
     std::string getRootName(const std::string name);
 
   private:
-    ndn::Name processIdentity;
-    ndn::Name routerIdentity;
-    ndn::Name processCertName;
-    ndn::Name routerCertName;
-    ndn::Name opCertName;
-    ndn::Name siteCertName;
-    ndn::Name rootCertName;
-    ndn::Name processKeyName;
-    uint32_t certSeqNo;
-    string certSeqFileNameWithPath;
-    string nlsrRootKeyPrefix;
-    NlsrCertificateStore certStore;
+    ndn::Name m_processIdentity;
+    ndn::Name m_routerIdentity;
+    ndn::Name m_processCertName;
+    ndn::Name m_routerCertName;
+    ndn::Name m_opCertName;
+    ndn::Name m_siteCertName;
+    ndn::Name m_rootCertName;
+    ndn::Name m_processKeyName;
+    uint32_t m_certSeqNo;
+    string m_certSeqFileNameWithPath;
+    string m_nlsrRootKeyPrefix;
+    NlsrCertificateStore m_certStore;
 
   };
 }
diff --git a/src/security/nlsr_wl.cpp b/src/security/nlsr_wl.cpp
index 39ddfe3..442afe3 100644
--- a/src/security/nlsr_wl.cpp
+++ b/src/security/nlsr_wl.cpp
@@ -1,6 +1,8 @@
 #include <ndn-cpp-dev/face.hpp>
 #include "nlsr_wl.hpp"
 
+#define THIS_FILE "nlsr_wl.cpp"
+
 namespace nlsr
 {
   static bool
@@ -12,9 +14,9 @@
   std::pair<WaitingListEntry, bool> 
   WaitingList::getWaitingListEntry(std::string respCert)
   {
-    std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
-                waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
-    if( it != waitingTable.end() )
+    std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+                m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+    if( it != m_waitingTable.end() )
     {
       return std::make_pair(*(it),true);
     }
@@ -25,15 +27,15 @@
   }
   
   bool 
-  WaitingList::addtoWaitingList(std::string respCert, std::string waitee)
+  WaitingList::add(std::string respCert, std::string waitee)
   {
-    std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
-                waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
-    if( it == waitingTable.end() )
+    std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+                m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+    if( it == m_waitingTable.end() )
     {
       WaitingListEntry newWle(respCert);
       newWle.addWaitee(waitee);
-      waitingTable.push_back(newWle);
+      m_waitingTable.push_back(newWle);
       return true;
     }
     else
@@ -44,17 +46,17 @@
   }
   
   bool 
-  WaitingList::removeFromWaitingList(std::string respCert)
+  WaitingList::remove(std::string respCert)
   {
-    std::list<WaitingListEntry>::iterator it = std::find_if( waitingTable.begin(),
-                waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
-    if( it == waitingTable.end() )
+    std::list<WaitingListEntry>::iterator it = std::find_if( m_waitingTable.begin(),
+                m_waitingTable.end(),ndn::bind(&waitingListCompare, _1, respCert));
+    if( it == m_waitingTable.end() )
     {
       return false;
     }
     else
     {
-      waitingTable.erase(it);
+      m_waitingTable.erase(it);
       return true;
     }
     return false;
diff --git a/src/security/nlsr_wl.hpp b/src/security/nlsr_wl.hpp
index c287842..1a752ca 100644
--- a/src/security/nlsr_wl.hpp
+++ b/src/security/nlsr_wl.hpp
@@ -9,20 +9,20 @@
   {
     public:
       WaitingList()
-        : waitingTable()
+        : m_waitingTable()
       {}
       
       std::list<WaitingListEntry>& getWaitingTable()
       {
-        return waitingTable;
+        return m_waitingTable;
       }
       
-      bool addtoWaitingList(std::string respCert, std::string waitee);
+      bool add(std::string respCert, std::string waitee);
       std::pair<WaitingListEntry, bool> getWaitingListEntry(std::string respCert);
-      bool removeFromWaitingList(std::string respCert);
+      bool remove(std::string respCert);
       
     private:
-      std::list<WaitingListEntry> waitingTable;
+      std::list<WaitingListEntry> m_waitingTable;
   };
   
   std::ostream& operator<<(std::ostream& os, WaitingList wl);
diff --git a/src/security/nlsr_wle.cpp b/src/security/nlsr_wle.cpp
index df83544..37caf6d 100644
--- a/src/security/nlsr_wle.cpp
+++ b/src/security/nlsr_wle.cpp
@@ -3,6 +3,8 @@
 #include <ndn-cpp-dev/face.hpp>
 #include "nlsr_wle.hpp"
 
+#define THIS_FILE "nlsr_wle.cpp"
+
 namespace nlsr
 {
   static bool
@@ -14,11 +16,11 @@
   bool
   WaitingListEntry::addWaitee(std::string waiteeName)
   {
-    std::list<std::string>::iterator it = std::find_if( waitingCerts.begin(),
-                waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
-    if( it == waitingCerts.end() )
+    std::list<std::string>::iterator it = std::find_if( m_waitingCerts.begin(),
+                m_waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
+    if( it == m_waitingCerts.end() )
     {
-      waitingCerts.push_back(waiteeName);
+      m_waitingCerts.push_back(waiteeName);
       return true;
     }
     
diff --git a/src/security/nlsr_wle.hpp b/src/security/nlsr_wle.hpp
index c8e6fd6..0647382 100644
--- a/src/security/nlsr_wle.hpp
+++ b/src/security/nlsr_wle.hpp
@@ -10,35 +10,35 @@
   {
     public:
       WaitingListEntry()
-        : responsibleCert()
-        , waitingCerts()
+        : m_responsibleCert()
+        , m_waitingCerts()
       {}
       
       WaitingListEntry(std::string resCert)
-        : responsibleCert(resCert)
-        , waitingCerts()
+        : m_responsibleCert(resCert)
+        , m_waitingCerts()
       {}
       
       std::string getResponsibleCert() const
       {
-        return responsibleCert;
+        return m_responsibleCert;
       }
       
       void setResponsibleCert(std::string resCert)
       {
-        responsibleCert=resCert;
+        m_responsibleCert=resCert;
       }
       
       std::list<std::string> getWaitingCerts() const
       {
-        return waitingCerts;
+        return m_waitingCerts;
       }
       
       bool addWaitee(std::string waiteeName);
       
     private:
-      std::string responsibleCert;
-      std::list<std::string> waitingCerts;
+      std::string m_responsibleCert;
+      std::list<std::string> m_waitingCerts;
   };
   
   std::ostream& operator<<(std::ostream& os, const WaitingListEntry& we);
diff --git a/src/utility/nlsr_logger.cpp b/src/utility/nlsr_logger.cpp
index 82b6e75..f214c6a 100644
--- a/src/utility/nlsr_logger.cpp
+++ b/src/utility/nlsr_logger.cpp
@@ -49,7 +49,7 @@
           keywords::min_free_space = 64 * 1024 * 1024
         ));
     sink->set_formatter(
-      expr::format("%1%: %2%")
+      expr::format("%1% %2%")
       % getEpochTime()
       % expr::smessage
     );
diff --git a/src/utility/nlsr_tokenizer.cpp b/src/utility/nlsr_tokenizer.cpp
index 35d6625..a1ed2bd 100644
--- a/src/utility/nlsr_tokenizer.cpp
+++ b/src/utility/nlsr_tokenizer.cpp
@@ -15,8 +15,8 @@
   void
   nlsrTokenizer::makeToken()
   {
-    char_separator<char> sep(seps.c_str());
-    tokenizer< char_separator<char> >tokens(originalString, sep);
+    char_separator<char> sep(m_seps.c_str());
+    tokenizer< char_separator<char> >tokens(m_originalString, sep);
     tokenizer< char_separator<char> >::iterator tok_iter = tokens.begin();
     for ( ; tok_iter != tokens.end(); ++tok_iter)
     {
@@ -27,15 +27,15 @@
         insertToken(oneToken);
       }
     }
-    firstToken=vTokenList[0];
+    m_firstToken=m_vTokenList[0];
     makeRestOfTheLine();
   }
 
   void
   nlsrTokenizer::insertToken(const string& token)
   {
-    tokenList.push_back(token);
-    vTokenList.push_back(token);
+    m_tokenList.push_back(token);
+    m_vTokenList.push_back(token);
   }
 
   int
@@ -43,8 +43,8 @@
   {
     int pos=-1;
     int i=0;
-    for(std::list<string>::iterator it=tokenList.begin();
-        it!=tokenList.end(); it++)
+    for(std::list<string>::iterator it=m_tokenList.begin();
+        it!=m_tokenList.end(); it++)
     {
       if( (*it) == token )
       {
@@ -52,7 +52,7 @@
       }
       i++;
     }
-    if( i < tokenList.size() )
+    if( i < m_tokenList.size() )
     {
       pos=i;
     }
@@ -63,13 +63,13 @@
   nlsrTokenizer::getTokenString(int from , int to)
   {
     string returnString="";
-    if((from>=0 && to<tokenList.size()) &&
-        (to>=from && to <tokenList.size()))
+    if((from>=0 && to<m_tokenList.size()) &&
+        (to>=from && to <m_tokenList.size()))
     {
       for(int i=from; i<=to; i++)
       {
-        returnString+=seps;
-        returnString+=vTokenList[i];
+        returnString+=m_seps;
+        returnString+=m_vTokenList[i];
       }
     }
     trim(returnString);
@@ -79,7 +79,7 @@
   string
   nlsrTokenizer::getTokenString(int from)
   {
-    return getTokenString(from,tokenList.size()-1);
+    return getTokenString(from,m_tokenList.size()-1);
   }
 
   static bool
@@ -91,16 +91,16 @@
   void
   nlsrTokenizer::makeRestOfTheLine()
   {
-    restOfTheLine=getTokenString(1);
+    m_restOfTheLine=getTokenString(1);
   }
 
   bool
   nlsrTokenizer::doesTokenExist(string token)
   {
-    std::list<string >::iterator it = std::find_if( tokenList.begin(),
-                                      tokenList.end(),
+    std::list<string >::iterator it = std::find_if( m_tokenList.begin(),
+                                      m_tokenList.end(),
                                       bind(&tokenCompare, _1 , token));
-    if( it != tokenList.end() )
+    if( it != m_tokenList.end() )
     {
       return true;
     }
diff --git a/src/utility/nlsr_tokenizer.hpp b/src/utility/nlsr_tokenizer.hpp
index 4b84d8b..02d6eea 100644
--- a/src/utility/nlsr_tokenizer.hpp
+++ b/src/utility/nlsr_tokenizer.hpp
@@ -19,62 +19,62 @@
   {
   public:
     nlsrTokenizer(const string& inputString)
-      : firstToken()
-      , restOfTheLine()
-      , currentPosition(0)
+      : m_firstToken()
+      , m_restOfTheLine()
+      , m_currentPosition(0)
     {
-      seps = " ";
-      originalString = inputString;
+      m_seps = " ";
+      m_originalString = inputString;
       makeToken();
     }
 
     nlsrTokenizer(const string& inputString, const string& separator)
-      : firstToken()
-      , restOfTheLine()
-      , currentPosition(0)
+      : m_firstToken()
+      , m_restOfTheLine()
+      , m_currentPosition(0)
     {
-      seps = separator;
-      originalString = inputString;
+      m_seps = separator;
+      m_originalString = inputString;
       makeToken();
     }
 
     string getFirstToken()
     {
-      return firstToken;
+      return m_firstToken;
     }
 
     string getRestOfLine()
     {
-      return restOfTheLine;
+      return m_restOfTheLine;
     }
 
     void resetCurrentPosition(uint32_t cp=0)
     {
-      if( cp >=0 && cp <= vTokenList.size() )
+      if( cp >=0 && cp <= m_vTokenList.size() )
       {
-        currentPosition=cp;
+        m_currentPosition=cp;
       }
     }
 
     string getNextToken()
     {
-      if(currentPosition >= 0 && currentPosition <= (vTokenList.size()-1))
+      if(m_currentPosition >= 0 && m_currentPosition <= (m_vTokenList.size()-1))
       {
-        return vTokenList[currentPosition++];
+        return m_vTokenList[m_currentPosition++];
       }
       return "";
     }
 
     uint32_t getTokenNumber()
     {
-      return tokenList.size();
+      return m_tokenList.size();
     }
 
     string getToken(int position)
     {
-      if( position >=0 && position <vTokenList.size() )
+      if( position >=0 && position <m_vTokenList.size() )
       {
-        return vTokenList[position];
+        return m_vTokenList[position];
       }
       return "";
     }
@@ -91,13 +91,13 @@
     void insertToken(const string& token);
     void makeRestOfTheLine();
 
-    string seps;
-    string originalString;
-    string firstToken;
-    string restOfTheLine;
-    std::list<string> tokenList;
-    std::vector<string> vTokenList;
-    uint32_t currentPosition;
+    string m_seps;
+    string m_originalString;
+    string m_firstToken;
+    string m_restOfTheLine;
+    std::list<string> m_tokenList;
+    std::vector<string> m_vTokenList;
+    uint32_t m_currentPosition;
   };
 
 }//namespace nlsr
