diff --git a/src/nlsr_lsdb.cpp b/src/nlsr_lsdb.cpp
index 7b662e2..f2e4433 100644
--- a/src/nlsr_lsdb.cpp
+++ b/src/nlsr_lsdb.cpp
@@ -39,10 +39,10 @@
   std::pair<NameLsa&, bool>
   Lsdb::getNameLsa(string key)
   {
-    std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
-                                       nameLsdb.end(),
+    std::list<NameLsa >::iterator it = std::find_if( m_nameLsdb.begin(),
+                                       m_nameLsdb.end(),
                                        bind(nameLsaCompareByKey, _1, key));
-    if( it != nameLsdb.end())
+    if( it != m_nameLsdb.end())
     {
       return std::make_pair(boost::ref((*it)),true);
     }
@@ -80,7 +80,7 @@
   Lsdb::installNameLsa(Nlsr& pnlsr, NameLsa &nlsa)
   {
     src::logger lg;
-    int timeToExpire=lsaRefreshTime;
+    int timeToExpire=m_lsaRefreshTime;
     std::pair<NameLsa& , bool> chkNameLsa=getNameLsa(nlsa.getKey());
     if ( !chkNameLsa.second )
     {
@@ -172,11 +172,11 @@
   bool
   Lsdb::addNameLsa(NameLsa &nlsa)
   {
-    std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
-                                       nameLsdb.end(), bind(nameLsaCompareByKey, _1, nlsa.getKey()));
-    if( it == nameLsdb.end())
+    std::list<NameLsa >::iterator it = std::find_if( m_nameLsdb.begin(),
+                                       m_nameLsdb.end(), bind(nameLsaCompareByKey, _1, nlsa.getKey()));
+    if( it == m_nameLsdb.end())
     {
-      nameLsdb.push_back(nlsa);
+      m_nameLsdb.push_back(nlsa);
       return true;
     }
     return false;
@@ -186,10 +186,10 @@
   Lsdb::removeNameLsa(Nlsr& pnlsr, string& key)
   {
     src::logger lg;
-    std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
-                                       nameLsdb.end(),
+    std::list<NameLsa >::iterator it = std::find_if( m_nameLsdb.begin(),
+                                       m_nameLsdb.end(),
                                        bind(nameLsaCompareByKey, _1, key));
-    if ( it != nameLsdb.end() )
+    if ( it != m_nameLsdb.end() )
     {
       BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Deleting name lsa";
       (*it).writeLog();
@@ -205,7 +205,7 @@
           }
         }
       }
-      nameLsdb.erase(it);
+      m_nameLsdb.erase(it);
       return true;
     }
     return false;
@@ -214,10 +214,10 @@
   bool
   Lsdb::doesNameLsaExist(string key)
   {
-    std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(),
-                                       nameLsdb.end(),
+    std::list<NameLsa >::iterator it = std::find_if( m_nameLsdb.begin(),
+                                       m_nameLsdb.end(),
                                        bind(nameLsaCompareByKey, _1, key));
-    if( it == nameLsdb.end())
+    if( it == m_nameLsdb.end())
     {
       return false;
     }
@@ -228,8 +228,8 @@
   Lsdb::printNameLsdb()
   {
     cout<<"---------------Name LSDB-------------------"<<endl;
-    for( std::list<NameLsa>::iterator it=nameLsdb.begin();
-         it!= nameLsdb.end() ; it++)
+    for( std::list<NameLsa>::iterator it=m_nameLsdb.begin();
+         it!= m_nameLsdb.end() ; it++)
     {
       cout<< (*it) <<endl;
     }
@@ -261,10 +261,10 @@
   std::pair<CorLsa&, bool>
   Lsdb::getCorLsa(string key)
   {
-    std::list< CorLsa >::iterator it = std::find_if( corLsdb.begin(),
-                                       corLsdb.end(),
+    std::list< CorLsa >::iterator it = std::find_if( m_corLsdb.begin(),
+                                       m_corLsdb.end(),
                                        bind(corLsaCompareByKey, _1, key));
-    if( it != corLsdb.end())
+    if( it != m_corLsdb.end())
     {
       return std::make_pair(boost::ref((*it)), true);
     }
@@ -301,7 +301,7 @@
   bool
   Lsdb::installCorLsa(Nlsr& pnlsr, CorLsa &clsa)
   {
-    int timeToExpire=lsaRefreshTime;
+    int timeToExpire=m_lsaRefreshTime;
     std::pair<CorLsa& , bool> chkCorLsa=getCorLsa(clsa.getKey());
     if ( !chkCorLsa.second )
     {
@@ -355,12 +355,12 @@
   bool
   Lsdb::addCorLsa(CorLsa& clsa)
   {
-    std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(),
-                                      corLsdb.end(),
+    std::list<CorLsa >::iterator it = std::find_if( m_corLsdb.begin(),
+                                      m_corLsdb.end(),
                                       bind(corLsaCompareByKey, _1, clsa.getKey()));
-    if( it == corLsdb.end())
+    if( it == m_corLsdb.end())
     {
-      corLsdb.push_back(clsa);
+      m_corLsdb.push_back(clsa);
       return true;
     }
     return false;
@@ -369,16 +369,16 @@
   bool
   Lsdb::removeCorLsa(Nlsr& pnlsr, string& key)
   {
-    std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(),
-                                      corLsdb.end(),
+    std::list<CorLsa >::iterator it = std::find_if( m_corLsdb.begin(),
+                                      m_corLsdb.end(),
                                       bind(corLsaCompareByKey, _1, key));
-    if ( it != corLsdb.end() )
+    if ( it != m_corLsdb.end() )
     {
       if ( (*it).getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() )
       {
         pnlsr.getNpt().removeNpte((*it).getOrigRouter(),(*it).getOrigRouter(),pnlsr);
       }
-      corLsdb.erase(it);
+      m_corLsdb.erase(it);
       return true;
     }
     return false;
@@ -387,10 +387,10 @@
   bool
   Lsdb::doesCorLsaExist(string key)
   {
-    std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(),
-                                      corLsdb.end(),
+    std::list<CorLsa >::iterator it = std::find_if( m_corLsdb.begin(),
+                                      m_corLsdb.end(),
                                       bind(corLsaCompareByKey, _1, key));
-    if( it == corLsdb.end())
+    if( it == m_corLsdb.end())
     {
       return false;
     }
@@ -401,8 +401,8 @@
   Lsdb::printCorLsdb() //debugging
   {
     cout<<"---------------Cor LSDB-------------------"<<endl;
-    for( std::list<CorLsa>::iterator it=corLsdb.begin();
-         it!= corLsdb.end() ; it++)
+    for( std::list<CorLsa>::iterator it=m_corLsdb.begin();
+         it!= m_corLsdb.end() ; it++)
     {
       cout<< (*it) <<endl;
     }
@@ -456,12 +456,12 @@
   bool
   Lsdb::addAdjLsa(AdjLsa &alsa)
   {
-    std::list<AdjLsa >::iterator it = std::find_if( adjLsdb.begin(),
-                                      adjLsdb.end(),
+    std::list<AdjLsa >::iterator it = std::find_if( m_adjLsdb.begin(),
+                                      m_adjLsdb.end(),
                                       bind(adjLsaCompareByKey, _1, alsa.getKey()));
-    if( it == adjLsdb.end())
+    if( it == m_adjLsdb.end())
     {
-      adjLsdb.push_back(alsa);
+      m_adjLsdb.push_back(alsa);
       return true;
     }
     return false;
@@ -470,10 +470,10 @@
   std::pair<AdjLsa& , bool>
   Lsdb::getAdjLsa(string key)
   {
-    std::list<AdjLsa >::iterator it = std::find_if( adjLsdb.begin(),
-                                      adjLsdb.end(),
+    std::list<AdjLsa >::iterator it = std::find_if( m_adjLsdb.begin(),
+                                      m_adjLsdb.end(),
                                       bind(adjLsaCompareByKey, _1, key));
-    if( it != adjLsdb.end())
+    if( it != m_adjLsdb.end())
     {
       return std::make_pair(boost::ref((*it)),true);
     }
@@ -512,7 +512,7 @@
   bool
   Lsdb::installAdjLsa(Nlsr& pnlsr, AdjLsa &alsa)
   {
-    int timeToExpire=lsaRefreshTime;
+    int timeToExpire=m_lsaRefreshTime;
     std::pair<AdjLsa& , bool> chkAdjLsa=getAdjLsa(alsa.getKey());
     if ( !chkAdjLsa.second )
     {
@@ -570,13 +570,13 @@
   bool
   Lsdb::removeAdjLsa(Nlsr& pnlsr, string& key)
   {
-    std::list<AdjLsa >::iterator it = std::find_if( adjLsdb.begin(),
-                                      adjLsdb.end(),
+    std::list<AdjLsa >::iterator it = std::find_if( m_adjLsdb.begin(),
+                                      m_adjLsdb.end(),
                                       bind(adjLsaCompareByKey, _1, key));
-    if ( it != adjLsdb.end() )
+    if ( it != m_adjLsdb.end() )
     {
       (*it).removeNptEntries(pnlsr);
-      adjLsdb.erase(it);
+      m_adjLsdb.erase(it);
       return true;
     }
     return false;
@@ -585,10 +585,10 @@
   bool
   Lsdb::doesAdjLsaExist(string key)
   {
-    std::list< AdjLsa >::iterator it = std::find_if( adjLsdb.begin(),
-                                       adjLsdb.end(),
+    std::list< AdjLsa >::iterator it = std::find_if( m_adjLsdb.begin(),
+                                       m_adjLsdb.end(),
                                        bind(adjLsaCompareByKey, _1, key));
-    if( it == adjLsdb.end())
+    if( it == m_adjLsdb.end())
     {
       return false;
     }
@@ -598,19 +598,19 @@
   std::list<AdjLsa>&
   Lsdb::getAdjLsdb()
   {
-    return adjLsdb;
+    return m_adjLsdb;
   }
 
   void
   Lsdb::setLsaRefreshTime(int lrt)
   {
-    lsaRefreshTime=lrt;
+    m_lsaRefreshTime=lrt;
   }
 
   void
   Lsdb::setThisRouterPrefix(string trp)
   {
-    thisRouterPrefix=trp;
+    m_thisRouterPrefix=trp;
   }
 
   void
@@ -624,7 +624,7 @@
       cout<<" LSA Exists with seq no: "<<chkNameLsa.first.getLsSeqNo()<<endl;
       if ( chkNameLsa.first.getLsSeqNo() == seqNo )
       {
-        if(chkNameLsa.first.getOrigRouter() == thisRouterPrefix )
+        if(chkNameLsa.first.getOrigRouter() == m_thisRouterPrefix )
         {
           src::logger lg;
           BOOST_LOG(lg)<<" "<<THIS_FILE<<" "<<__LINE__<<": "<<"Deleting name lsa";
@@ -659,7 +659,7 @@
       cout<<" LSA Exists with seq no: "<<chkAdjLsa.first.getLsSeqNo()<<endl;
       if ( chkAdjLsa.first.getLsSeqNo() == seqNo )
       {
-        if(chkAdjLsa.first.getOrigRouter() == thisRouterPrefix )
+        if(chkAdjLsa.first.getOrigRouter() == m_thisRouterPrefix )
         {
           cout<<"Own Adj LSA, so refreshing Adj LSA"<<endl;
           chkAdjLsa.first.setLsSeqNo(chkAdjLsa.first.getLsSeqNo()+1);
@@ -691,7 +691,7 @@
       cout<<" LSA Exists with seq no: "<<chkCorLsa.first.getLsSeqNo()<<endl;
       if ( chkCorLsa.first.getLsSeqNo() == seqNo )
       {
-        if(chkCorLsa.first.getOrigRouter() == thisRouterPrefix )
+        if(chkCorLsa.first.getOrigRouter() == m_thisRouterPrefix )
         {
           cout<<"Own Cor LSA, so refreshing Cor LSA"<<endl;
           chkCorLsa.first.setLsSeqNo(chkCorLsa.first.getLsSeqNo()+1);
@@ -719,8 +719,8 @@
   Lsdb::printAdjLsdb()
   {
     cout<<"---------------Adj LSDB-------------------"<<endl;
-    for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
-         it!= adjLsdb.end() ; it++)
+    for( std::list<AdjLsa>::iterator it=m_adjLsdb.begin();
+         it!= m_adjLsdb.end() ; it++)
     {
       cout<< (*it) <<endl;
     }
