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);
