diff --git a/CertTool/cert_tool.cpp b/CertTool/cert_tool.cpp
index d88394c..d28340f 100644
--- a/CertTool/cert_tool.cpp
+++ b/CertTool/cert_tool.cpp
@@ -86,8 +86,8 @@
                 certificateName.append("KEY").append(
                     keyName.get(-1)).append("ID-CERT").appendVersion();
                 certificate->setName(certificateName);
-                certificate->setNotBefore(ndn::getNow());
-                certificate->setNotAfter(ndn::getNow() + 63072000 /* 2 years*/);
+                certificate->setNotBefore(ndn::time::system_clock::now());
+                certificate->setNotAfter(ndn::time::system_clock::now() + ndn::time::days(730) /* 2 years*/);
                 certificate->setPublicKeyInfo(*pubKey);
                 certificate->addSubjectDescription(
                     ndn::CertificateSubjectDescription("2.5.4.41",
@@ -110,7 +110,7 @@
                         }
                         return identityName;
                     }
-                    ndn::KeyChain::addCertificate(*(certificate));
+                    ndn::KeyChain::addCertificateAsIdentityDefault(*(certificate));
                 }
                 
                 certName=certificate->getName();
@@ -135,7 +135,7 @@
             try
             {
                 ndn::KeyChain::deleteCertificate(cert->getName());
-                ndn::KeyChain::addCertificate(*(cert));
+                ndn::KeyChain::addCertificateAsIdentityDefault(*(cert));
                 return true;
             }
             catch(InfoError& e)
diff --git a/nsync/src/sync-full-state.cc b/nsync/src/sync-full-state.cc
index eb9ca4c..7000606 100644
--- a/nsync/src/sync-full-state.cc
+++ b/nsync/src/sync-full-state.cc
@@ -45,10 +45,10 @@
 {
 }
 
-ndn::time::Duration
+ndn::time::system_clock::Duration
 FullState::getTimeFromLastUpdate () const
 {
-  return ndn::time::now() - m_lastUpdated;
+  return ndn::time::system_clock::now() - m_lastUpdated;
 }
 
 DigestConstPtr
@@ -81,7 +81,7 @@
 boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
 FullState::update (NameInfoConstPtr info, const SeqNo &seq)
 {
-  m_lastUpdated = ndn::time::now();
+  m_lastUpdated = ndn::time::system_clock::now();
 
 
   m_digest.reset ();
@@ -109,7 +109,7 @@
 bool
 FullState::remove (NameInfoConstPtr info)
 {
-  m_lastUpdated = ndn::time::now();
+  m_lastUpdated = ndn::time::system_clock::now();
 
   m_digest.reset ();
 
diff --git a/nsync/src/sync-full-state.h b/nsync/src/sync-full-state.h
index 28e0078..028c41e 100644
--- a/nsync/src/sync-full-state.h
+++ b/nsync/src/sync-full-state.h
@@ -51,7 +51,7 @@
    *
    * This value can be used to randomize reconciliation waiting time in SyncApp
    */
-  ndn::time::Duration
+  ndn::time::system_clock::Duration
   getTimeFromLastUpdate () const;
 
   /**
@@ -70,7 +70,7 @@
   remove (NameInfoConstPtr info);
   
 private:
-  ndn::time::Point m_lastUpdated; ///< @brief Time when state was updated last time
+  ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
   DigestPtr m_digest;
 };
 
diff --git a/nsync/src/sync-interest-container.h b/nsync/src/sync-interest-container.h
index 742f053..f674d05 100644
--- a/nsync/src/sync-interest-container.h
+++ b/nsync/src/sync-interest-container.h
@@ -47,14 +47,14 @@
   Interest (DigestConstPtr digest, const std::string &name, bool unknown=false)
   : m_digest (digest)
   , m_name (name)
-  , m_time (ndn::time::now())
+  , m_time (ndn::time::system_clock::now())
   , m_unknown (unknown)
   {
   }
   
   DigestConstPtr   m_digest;
   std::string      m_name;
-  ndn::time::Point m_time;
+  ndn::time::system_clock::TimePoint m_time;
   bool             m_unknown;
 };
 
@@ -87,7 +87,7 @@
     
     mi::ordered_non_unique<
       mi::tag<timed>,
-      BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::Point, m_time)
+      BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
       >
     >
   >
diff --git a/nsync/src/sync-interest-table.cc b/nsync/src/sync-interest-table.cc
index a378950..415b641 100644
--- a/nsync/src/sync-interest-table.cc
+++ b/nsync/src/sync-interest-table.cc
@@ -29,7 +29,7 @@
 namespace Sync
 {
 
-SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime)
+SyncInterestTable::SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime)
   : m_entryLifetime (lifetime)
   , m_scheduler(io)
 {
@@ -103,7 +103,7 @@
 void SyncInterestTable::expireInterests ()
 { 
   uint32_t count = 0;
-  ndn::time::Point expireTime = ndn::time::now() - m_entryLifetime;
+  ndn::time::system_clock::TimePoint expireTime = ndn::time::system_clock::now() - m_entryLifetime;
   
   while (m_table.size () > 0)
     {
diff --git a/nsync/src/sync-interest-table.h b/nsync/src/sync-interest-table.h
index 9b7c46b..4810c41 100644
--- a/nsync/src/sync-interest-table.h
+++ b/nsync/src/sync-interest-table.h
@@ -42,7 +42,7 @@
 class SyncInterestTable
 {
 public:
-  SyncInterestTable (boost::asio::io_service& io, ndn::time::Duration lifetime);
+  SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime);
   ~SyncInterestTable ();
 
   /**
@@ -81,7 +81,7 @@
   expireInterests ();
 
 private:
-  ndn::time::Duration m_entryLifetime;
+  ndn::time::system_clock::Duration m_entryLifetime;
   InterestContainer m_table;
 
   ndn::Scheduler m_scheduler;
diff --git a/nsync/src/sync-logic.cc b/nsync/src/sync-logic.cc
index ec4d63e..c915718 100644
--- a/nsync/src/sync-logic.cc
+++ b/nsync/src/sync-logic.cc
@@ -63,6 +63,10 @@
                       LogicUpdateCallback onUpdate,
                       LogicRemoveCallback onRemove)
   : m_state (new FullState)
+  , m_unknownDigestStoreTime(10)
+  , m_syncResponseFreshness(1000)
+  , m_syncInterestReexpress(4)
+  , m_defaultRecoveryRetransmitInterval(200)
   , m_syncInterestTable (*face->ioService(), time::seconds(m_syncInterestReexpress))
   , m_syncPrefix (syncPrefix)
   , m_onUpdate (onUpdate)
@@ -424,7 +428,7 @@
       // satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
   
       // if state has changed, then it is safe to express a new interest
-      time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+      time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
       // cout << "------------ reexpress interest after: " << after << endl;
       EventId eventId = m_scheduler.scheduleEvent (after,
                                                    bind (&SyncLogic::sendSyncInterest, this));
@@ -596,7 +600,7 @@
   Name interestName = m_syncPrefix;
   interestName.append("recovery").append(os.str());
 
-  time::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
+  time::system_clock::Duration nextRetransmission = time::milliseconds (m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
 
   m_recoveryRetransmissionInterval <<= 1;
     
@@ -634,7 +638,7 @@
 
   Data syncData(name);
   syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
-  syncData.setFreshnessPeriod(m_syncResponseFreshness);
+  syncData.setFreshnessPeriod(time::seconds(m_syncResponseFreshness));
   
   m_keyChain->sign(syncData);
   
@@ -652,7 +656,7 @@
     {
       _LOG_DEBUG_ID ("Satisfied our own Interest. Re-expressing (hopefully with a new digest)");
       
-      time::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
+      time::system_clock::Duration after = time::milliseconds(GET_RANDOM (m_reexpressionJitter));
       // cout << "------------ reexpress interest after: " << after << endl;
       EventId eventId = m_scheduler.scheduleEvent (after,
                                                    bind (&SyncLogic::sendSyncInterest, this));
diff --git a/nsync/src/sync-logic.h b/nsync/src/sync-logic.h
index fc63fca..25d7c5c 100644
--- a/nsync/src/sync-logic.h
+++ b/nsync/src/sync-logic.h
@@ -176,6 +176,12 @@
   
 private:
   FullStatePtr m_state;
+  
+  int m_unknownDigestStoreTime;
+  int m_syncResponseFreshness;
+  int m_syncInterestReexpress;
+  int m_defaultRecoveryRetransmitInterval;
+  
   DiffStateContainer m_log;
 
   ndn::Name m_outstandingInterestName;
@@ -197,11 +203,14 @@
   boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_rangeUniformRandom;
   boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_reexpressionJitter;
 
+  /*
   static const int m_unknownDigestStoreTime = 10; // seconds
   static const int m_syncResponseFreshness = 1000; // MUST BE dividable by 1000!!!
   static const int m_syncInterestReexpress = 4; // seconds
 
   static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
+  */
+  
   uint32_t m_recoveryRetransmissionInterval; // milliseconds
   
   ndn::EventId m_delayedInterestProcessingId;
diff --git a/nsync/src/sync-socket.cc b/nsync/src/sync-socket.cc
index db51ce2..bd4c0e4 100644
--- a/nsync/src/sync-socket.cc
+++ b/nsync/src/sync-socket.cc
@@ -56,7 +56,7 @@
 {
   shared_ptr<Data> data = make_shared<Data>();
   data->setContent(reinterpret_cast<const uint8_t*>(buf), len);
-  data->setFreshnessPeriod(1000*freshness);
+  data->setFreshnessPeriod(time::seconds(freshness));
 
   m_ioService->post(bind(&SyncSocket::publishDataInternal, this, data, prefix, session,seq));
 
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
diff --git a/waf-tools/openssl.py b/waf-tools/openssl.py
new file mode 100644
index 0000000..7f599a9
--- /dev/null
+++ b/waf-tools/openssl.py
@@ -0,0 +1,59 @@
+#! /usr/bin/env python
+# encoding: utf-8
+
+'''
+
+When using this tool, the wscript will look like:
+
+	def options(opt):
+	        opt.tool_options('openssl')
+
+	def configure(conf):
+		conf.load('compiler_c openssl')
+
+                conf.check_openssl()
+
+	def build(bld):
+		bld(source='main.cpp', target='app', use='OPENSSL')
+
+'''
+
+from waflib import Options
+from waflib.Configure import conf
+
+@conf
+def check_openssl(self,*k,**kw):
+        root = k and k[0] or kw.get('path',None) or Options.options.with_openssl
+        mandatory = kw.get('mandatory', True)
+        var = kw.get('var', 'OPENSSL')
+
+        CODE = """
+#include <openssl/crypto.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+	(void)argc;
+        printf ("%s", argv[0]);
+
+	return 0;
+}
+"""
+        if root:
+                libcrypto = self.check_cc (lib=['ssl', 'crypto'],
+                                           header_name='openssl/crypto.h',
+                                           define_name='HAVE_%s' % var,
+                                           uselib_store=var,
+                                           mandatory = mandatory,
+                                           cflags="-I%s/include" % root,
+                                           linkflags="-L%s/lib" % root,
+                                           execute = True, fragment = CODE, define_ret = True)
+        else:
+                libcrypto = self.check_cc (lib=['ssl', 'crypto'],
+                                           header_name='openssl/crypto.h',
+                                           define_name='HAVE_%s' % var,
+                                           uselib_store=var,
+                                           mandatory = mandatory,
+                                           execute = True, fragment = CODE, define_ret = True)
+
+def options(opt):
+        opt.add_option('--with-openssl',type='string',default='',dest='with_openssl',help='''Path to OpenSSL''')
diff --git a/wscript b/wscript
index 061fb26..200ccbf 100644
--- a/wscript
+++ b/wscript
@@ -1,16 +1,23 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+VERSION='1.0'
+NAME="NLSR"
 
 from waflib import Build, Logs, Utils, Task, TaskGen, Configure
+from waflib.Tools import c_preproc
 
 def options(opt):
     opt.load('compiler_c compiler_cxx gnu_dirs c_osx')
-    opt.load('boost cryptopp', tooldir=['waf-tools'])
+    opt.load('boost openssl cryptopp', tooldir=['waf-tools'])
 
-    opt = opt.add_option_group('Options')
+    opt = opt.add_option_group('NLSR Options')
+
     opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
 
+
 def configure(conf):
-    conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx cryptopp")
+    conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx openssl cryptopp")
+
+    conf.check_openssl()
 
     if conf.options.debug:
         conf.define ('_DEBUG', 1)
@@ -30,15 +37,22 @@
 
         conf.add_supported_cxxflags (cxxflags = flags)
     else:
-        flags = ['-O3', '-g','-Wno-unused-variable', '-Wno-tautological-compare',
-                         '-Wno-unused-function', '-Wno-deprecated-declarations']
+        flags = ['-O3', '-g', '-Wno-tautological-compare', '-Wno-unused-function', '-Wno-deprecated-declarations']
         conf.add_supported_cxxflags (cxxflags = flags)
 
+
     conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
-    conf.check_boost(lib='system iostreams thread unit_test_framework log', uselib_store='BOOST', version='1_55', mandatory=True)
     conf.check_cfg(package='nsync', args=['--cflags', '--libs'], uselib_store='nsync', mandatory=True)
     conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
     conf.check_cryptopp(path=conf.options.cryptopp_dir, mandatory=True)
+    conf.check_boost(lib='system iostreams thread unit_test_framework log', uselib_store='BOOST', mandatory=True)
+    if conf.env.BOOST_VERSION_NUMBER < 105400:
+        Logs.error ("Minimum required boost version is 1.54.0")
+        Logs.error ("Please upgrade your distribution or install custom boost libraries")
+        return
+
+
+
 
 def build (bld):
     bld (
