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
