Directory Structuring
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 3ca2279..84b5e6d 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -6,12 +6,9 @@
 #include <sstream>
 
 #include "nlsr.hpp"
-#include "nlsr_conf_param.hpp"
 #include "nlsr_conf_processor.hpp"
-#include "nlsr_lsdb.hpp"
-#include "nlsr_logger.hpp"
-//test purpose of NLSR
-#include "nlsr_test.hpp"
+#include "utility/nlsr_logger.hpp"
+
 
 namespace nlsr
 {
@@ -23,24 +20,37 @@
     Nlsr::nlsrRegistrationFailed(const ndn::Name& name)
     {
         cerr << "ERROR: Failed to register prefix in local hub's daemon" << endl;
-        getNlsrFace().shutdown();
+        getNlsrFace()->shutdown();
     }
 
 
     void
     Nlsr::setInterestFilterNlsr(const string& name)
     {
-        getNlsrFace().setInterestFilter(name,
-                                        func_lib::bind(&interestManager::processInterest, &im,
-                                                boost::ref(*this), _1, _2),
-                                        func_lib::bind(&Nlsr::nlsrRegistrationFailed, this, _1));
+        getNlsrFace()->setInterestFilter(name,
+                                         func_lib::bind(&interestManager::processInterest, &im,
+                                                 boost::ref(*this), _1, _2),
+                                         func_lib::bind(&Nlsr::nlsrRegistrationFailed, this, _1));
     }
 
+    void
+    Nlsr::initNlsr()
+    {
+        confParam.buildRouterPrefix();
+        nlsrLogger.initNlsrLogger(confParam.getLogDir());
+        nlsrLsdb.setLsaRefreshTime(confParam.getLsaRefreshTime());
+        nlsrLsdb.setThisRouterPrefix(confParam.getRouterPrefix());
+        fib.setFibEntryRefreshTime(2*confParam.getLsaRefreshTime());
+        km.initKeyManager(confParam);
+        sm.setSeqFileName(confParam.getSeqFileDir());
+        sm.initiateSeqNoFromFile();
+        slh.setSyncPrefix(confParam.getChronosyncSyncPrefix());
+    }
 
     void
     Nlsr::startEventLoop()
     {
-        getNlsrFace().processEvents();
+        io->run();
     }
 
     int
@@ -97,19 +107,7 @@
     {
         return EXIT_FAILURE;
     }
-    nlsr_.getConfParameter().buildRouterPrefix();
-    nlsr_.getNlsrLogger().initNlsrLogger(nlsr_.getConfParameter().getLogDir());
-    //src::logger lg;
-    //BOOST_LOG(lg) << "Some log record from nlsr.cpp";
-    //for(int j=0; j< 1000; j++)
-    //{
-    //	BOOST_LOG(lg) << "Some log record from nlsr.cpp "<<j;
-    //}
-    nlsr_.getLsdb().setLsaRefreshTime(nlsr_.getConfParameter().getLsaRefreshTime());
-    nlsr_.getFib().setFibEntryRefreshTime(
-                                    2*nlsr_.getConfParameter().getLsaRefreshTime());
-    nlsr_.getLsdb().setThisRouterPrefix(nlsr_.getConfParameter().getRouterPrefix());
-    nlsr_.getKeyManager().initKeyManager(nlsr_.getConfParameter());
+    nlsr_.initNlsr();
     /* debugging purpose start */
     cout <<	nlsr_.getConfParameter();
     nlsr_.getAdl().printAdl();
@@ -118,9 +116,15 @@
     nlsr_.getLsdb().buildAndInstallOwnNameLsa(nlsr_);
     nlsr_.getLsdb().buildAndInstallOwnCorLsa(nlsr_);
     nlsr_.setInterestFilterNlsr(nlsr_.getConfParameter().getRouterPrefix());
+    nlsr_.setInterestFilterNlsr(nlsr_.getConfParameter().getChronosyncLsaPrefix()+
+                                nlsr_.getConfParameter().getRouterPrefix());
+    nlsr_.setInterestFilterNlsr(nlsr_.getConfParameter().getRootKeyPrefix());
+    nlsr_.getSlh().createSyncSocket(nlsr_);
+    nlsr_.getSlh().publishKeyUpdate(nlsr_.getKeyManager());
+    nlsr_.getSlh().publishRoutingUpdate(nlsr_.getSm(),
+                                        nlsr_.getConfParameter().getChronosyncLsaPrefix()
+                                        + nlsr_.getConfParameter().getRouterPrefix());
     nlsr_.getIm().scheduleInfoInterest(nlsr_,1);
-    //testing purpose
-    nlsr_.getNlsrTesting().schedlueAddingLsas(nlsr_);
     try
     {
         nlsr_.startEventLoop();
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index cbf2af9..51218f0 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -8,17 +8,18 @@
 #include "nlsr_conf_param.hpp"
 #include "nlsr_adl.hpp"
 #include "nlsr_npl.hpp"
-#include "nlsr_im.hpp"
-#include "nlsr_dm.hpp"
+#include "communication/nlsr_im.hpp"
+#include "communication/nlsr_dm.hpp"
 #include "nlsr_lsdb.hpp"
 #include "nlsr_sm.hpp"
-#include "nlsr_rt.hpp"
-#include "nlsr_npt.hpp"
-#include "nlsr_fib.hpp"
-#include "nlsr_logger.hpp"
-#include "nlsr_km.hpp"
-//testing
-#include "nlsr_test.hpp"
+#include "route/nlsr_rt.hpp"
+#include "route/nlsr_npt.hpp"
+#include "route/nlsr_fib.hpp"
+#include "utility/nlsr_logger.hpp"
+#include "security/nlsr_km.hpp"
+#include "communication/nlsr_slh.hpp"
+
+
 
 namespace nlsr
 {
@@ -31,9 +32,8 @@
     public:
         Nlsr()
             : io(ndn::make_shared<boost::asio::io_service>())
-            , nlsrFace(io)
+            , nlsrFace(make_shared<ndn::Face>(io))
             , scheduler(*io)
-            , configFileName()
             , confParam()
             , adl()
             , npl()
@@ -41,6 +41,8 @@
             , dm()
             , sm()
             , km()
+            , isDaemonProcess(false)
+            , configFileName("nlsr.conf")
             , nlsrLsdb()
             , adjBuildCount(0)
             , isBuildAdjLsaSheduled(0)
@@ -49,12 +51,9 @@
             , routingTable()
             , npt()
             , fib()
+            , slh(io)
             , nlsrLogger()
-            , nlsrTesting()
-        {
-            isDaemonProcess=false;
-            configFileName="nlsr.conf";
-        }
+        {}
 
         void nlsrRegistrationFailed(const ndn::Name& name);
 
@@ -108,20 +107,16 @@
             return scheduler;
         }
 
-        ndn::Face& getNlsrFace()
+        ndn::shared_ptr<ndn::Face> getNlsrFace()
         {
             return nlsrFace;
         }
 
         KeyManager& getKeyManager()
         {
-        	return km;
+            return km;
         }
 
-//		ndn::KeyChain& getKeyChain()
-//        {
-//            return kChain;
-//        }
 
         interestManager& getIm()
         {
@@ -183,10 +178,6 @@
             isBuildAdjLsaSheduled=iabls;
         }
 
-        NlsrTest& getNlsrTesting()
-        {
-            return nlsrTesting;
-        }
 
         void setApiPort(int ap)
         {
@@ -218,19 +209,25 @@
             isRouteCalculationScheduled=ircs;
         }
 
+        SyncLogicHandler& getSlh()
+        {
+            return slh;
+        }
+
         NlsrLogger& getNlsrLogger()
         {
             return nlsrLogger;
         }
 
+        void initNlsr();
+
     private:
         ConfParameter confParam;
         Adl adl;
         Npl npl;
         ndn::shared_ptr<boost::asio::io_service> io;
         ndn::Scheduler scheduler;
-        ndn::Face nlsrFace;
-//      ndn::KeyChain kChain;
+        ndn::shared_ptr<ndn::Face> nlsrFace;
         interestManager im;
         DataManager dm;
         SequencingManager sm;
@@ -243,6 +240,7 @@
         RoutingTable routingTable;
         Npt npt;
         Fib fib;
+        SyncLogicHandler slh;
         NlsrLogger nlsrLogger;
 
         long int adjBuildCount;
@@ -250,7 +248,6 @@
         int isRouteCalculationScheduled;
         int isRoutingTableCalculating;
 
-        NlsrTest nlsrTesting;
 
 
     };
diff --git a/src/nlsr_conf_param.hpp b/src/nlsr_conf_param.hpp
index b2413ba..7fc51f2 100644
--- a/src/nlsr_conf_param.hpp
+++ b/src/nlsr_conf_param.hpp
@@ -13,21 +13,24 @@
 
     public:
         ConfParameter()
-            :chronosyncSyncPrefix("ndn/nlsr/sync")
-            ,chronosyncLsaPrefix("/ndn/nlsr/LSA")
-        {
-            isStrictHierchicalKeyCheck=0;
-            interestRetryNumber=3;
-            interestResendTime=5;
-            infoInterestInterval=60;
-            lsaRefreshTime=1800;
-            routerDeadInterval=3600;
-            maxFacesPerPrefix=0;
-            tunnelType=0;
-            detailedLogging=0;
-            debugging=0;
-            isHyperbolicCalc=0;
-        }
+            : chronosyncSyncPrefix("ndn/nlsr/sync")
+            , chronosyncLsaPrefix("/ndn/nlsr/LSA")
+            , rootKeyPrefix("/ndn/keys")
+            , isStrictHierchicalKeyCheck(0)
+            , interestRetryNumber(3)
+            , interestResendTime(5)
+            , infoInterestInterval(60)
+            , lsaRefreshTime(1800)
+            , routerDeadInterval(3600)
+            , maxFacesPerPrefix(0)
+            , tunnelType(0)
+            , detailedLogging(0)
+            , debugging(0)
+            , isHyperbolicCalc(0)
+            , seqFileDir()
+            , corR(0)
+            , corTheta(0)
+        {}
 
         void setRouterName(const string& rn)
         {
@@ -69,6 +72,16 @@
             return routerPrefix;
         }
 
+        string getRootKeyPrefix()
+        {
+            return rootKeyPrefix;
+        }
+
+        void setRootKeyPrefix(string rkp)
+        {
+            rootKeyPrefix=rkp;
+        }
+
         void setInterestRetryNumber(int irn)
         {
             interestRetryNumber=irn;
@@ -130,6 +143,16 @@
             return logDir;
         }
 
+        void setSeqFileDir(string ssfd)
+        {
+            seqFileDir=ssfd;
+        }
+
+        string getSeqFileDir()
+        {
+            return seqFileDir;
+        }
+
         void setDetailedLogging(int dl)
         {
             detailedLogging=dl;
@@ -200,6 +223,16 @@
             return chronosyncSyncPrefix;
         }
 
+        void setChronosyncLsaPrefix(string clp)
+        {
+            chronosyncLsaPrefix=clp;
+        }
+
+        string getChronosyncLsaPrefix()
+        {
+            return chronosyncLsaPrefix;
+        }
+
         int getInfoInterestInterval()
         {
             return infoInterestInterval;
@@ -221,6 +254,8 @@
         string chronosyncSyncPrefix;
         string chronosyncLsaPrefix;
 
+        string rootKeyPrefix;
+
         int interestRetryNumber;
         int interestResendTime;
         int infoInterestInterval;
@@ -229,6 +264,7 @@
 
         int maxFacesPerPrefix;
         string logDir;
+        string seqFileDir;
         string logFile;
         int detailedLogging;
         int debugging;
diff --git a/src/nlsr_conf_processor.cpp b/src/nlsr_conf_processor.cpp
index fd9e217..e6067f9 100644
--- a/src/nlsr_conf_processor.cpp
+++ b/src/nlsr_conf_processor.cpp
@@ -6,7 +6,7 @@
 
 #include "nlsr_conf_processor.hpp"
 #include "nlsr_conf_param.hpp"
-#include "nlsr_tokenizer.hpp"
+#include "utility/nlsr_tokenizer.hpp"
 #include "nlsr_adjacent.hpp"
 
 
@@ -63,6 +63,10 @@
         {
             ret=processConfCommandSiteName(pnlsr,nt.getRestOfLine());
         }
+        else if ( (nt.getFirstToken() == "root-key-prefix"))
+        {
+            ret=processConfCommandRootKeyPrefix(pnlsr,nt.getRestOfLine());
+        }
         else if ( (nt.getFirstToken() == "router-name"))
         {
             ret=processConfCommandRouterName(pnlsr,nt.getRestOfLine());
@@ -177,6 +181,30 @@
     }
 
     int
+    ConfFileProcessor::processConfCommandRootKeyPrefix(Nlsr& pnlsr, string command)
+    {
+        if(command.empty() )
+        {
+            cerr <<"Root Key Prefix can not be null or empty :( !"<<endl;
+            return -1;
+        }
+        else
+        {
+            if(command[command.size()-1] == '/' )
+            {
+                command.erase(command.size() - 1);
+            }
+            if(command[0] == '/' )
+            {
+                command.erase(0,1);
+            }
+            pnlsr.getConfParameter().setRootKeyPrefix(command);
+        }
+        return 0;
+    }
+
+
+    int
     ConfFileProcessor::processConfCommandRouterName(Nlsr& pnlsr, string command)
     {
         if(command.empty() )
diff --git a/src/nlsr_conf_processor.hpp b/src/nlsr_conf_processor.hpp
index c49e3c2..e97261e 100644
--- a/src/nlsr_conf_processor.hpp
+++ b/src/nlsr_conf_processor.hpp
@@ -24,6 +24,7 @@
         int processConfCommand(Nlsr& pnlsr, string command);
         int processConfCommandNetwork(Nlsr& pnlsr, string command);
         int processConfCommandSiteName(Nlsr& pnlsr, string command);
+        int processConfCommandRootKeyPrefix(Nlsr& pnlsr, string command);
         int processConfCommandRouterName(Nlsr& pnlsr, string command);
         int processConfCommandInterestRetryNumber(Nlsr& pnlsr, string command);
         int processConfCommandInterestResendTime(Nlsr& pnlsr, string command);
diff --git a/src/nlsr_dm.cpp b/src/nlsr_dm.cpp
deleted file mode 100644
index a88951b..0000000
--- a/src/nlsr_dm.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include<iostream>
-#include<cstdlib>
-
-#include "nlsr.hpp"
-#include "nlsr_dm.hpp"
-#include "nlsr_tokenizer.hpp"
-#include "nlsr_lsdb.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace ndn;
-
-    void
-    DataManager::processContent(Nlsr& pnlsr, const ndn::Interest &interest,
-                                const ndn::Data & data)
-    {
-        cout << "I: " << interest.toUri() << endl;
-        string dataName(data.getName().toUri());
-        string dataContent((char *)data.getContent().value());
-        cout << "D: " << dataName << endl;
-        cout << "Data Content: " << dataContent << endl;
-        nlsrTokenizer nt(dataName,"/");
-        string chkString("info");
-        if( nt.doesTokenExist(chkString) )
-        {
-            processContentInfo(pnlsr,dataName,dataContent);
-        }
-    }
-
-    void
-    DataManager::processContentInfo(Nlsr& pnlsr, string& dataName,
-                                    string& dataContent)
-    {
-        nlsrTokenizer nt(dataName,"/");
-        string chkString("info");
-        string neighbor="/" + nt.getFirstToken()
-                        +nt.getTokenString(0,nt.getTokenPosition(chkString)-1);
-        int oldStatus=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
-        int infoIntTimedOutCount=pnlsr.getAdl().getTimedOutInterestCount(neighbor);
-        //debugging purpose start
-        cout <<"Before Updates: " <<endl;
-        cout <<"Neighbor : "<<neighbor<<endl;
-        cout<<"Status: "<< oldStatus << endl;
-        cout<<"Info Interest Timed out: "<< infoIntTimedOutCount <<endl;
-        //debugging purpose end
-        pnlsr.getAdl().setStatusOfNeighbor(neighbor,1);
-        pnlsr.getAdl().setTimedOutInterestCount(neighbor,0);
-        int newStatus=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
-        infoIntTimedOutCount=pnlsr.getAdl().getTimedOutInterestCount(neighbor);
-        //debugging purpose
-        cout <<"After Updates: " <<endl;
-        cout <<"Neighbor : "<<neighbor<<endl;
-        cout<<"Status: "<< newStatus << endl;
-        cout<<"Info Interest Timed out: "<< infoIntTimedOutCount <<endl;
-        //debugging purpose end
-        if ( ( oldStatus-newStatus)!= 0 ) // change in Adjacency list
-        {
-            pnlsr.incrementAdjBuildCount();
-            /* Need to schedule event for Adjacency LSA building */
-            if ( pnlsr.getIsBuildAdjLsaSheduled() == 0 )
-            {
-                pnlsr.setIsBuildAdjLsaSheduled(1);
-                // event here
-                pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(5),
-                                                   ndn::bind(&Lsdb::scheduledAdjLsaBuild, pnlsr.getLsdb(),
-                                                           boost::ref(pnlsr)));
-            }
-        }
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_dm.hpp b/src/nlsr_dm.hpp
deleted file mode 100644
index 64b9006..0000000
--- a/src/nlsr_dm.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef NLSR_DM_HPP
-#define NLSR_DM_HPP
-
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
-namespace nlsr
-{
-
-    using namespace ndn;
-    using namespace std;
-
-    class Nlsr;
-
-    class DataManager
-    {
-    public:
-        void processContent(Nlsr& pnlsr, const ndn::Interest &interest,
-                            const ndn::Data& data);
-        void processContentInfo(Nlsr& pnlsr, string& dataName,
-                                string& dataContent);
-    private:
-
-    };
-
-}//namespace nlsr
-#endif
diff --git a/src/nlsr_fe.cpp b/src/nlsr_fe.cpp
deleted file mode 100644
index 5f4811c..0000000
--- a/src/nlsr_fe.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <list>
-#include "nlsr_fe.hpp"
-#include "nlsr_nexthop.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    bool
-    FibEntry::isEqualNextHops(Nhl &nhlOther)
-    {
-        if ( nhl.getNhlSize() != nhlOther.getNhlSize() )
-        {
-            return false;
-        }
-        else
-        {
-            int nhCount=0;
-            std::list<NextHop>::iterator it1, it2;
-            for ( it1=nhl.getNextHopList().begin(),
-                    it2 = nhlOther.getNextHopList().begin() ;
-                    it1 != nhl.getNextHopList().end() ; it1++, it2++)
-            {
-                if ((*it1).getConnectingFace() == (*it2).getConnectingFace() )
-                {
-                    (*it1).setRouteCost((*it2).getRouteCost());
-                    nhCount++;
-                }
-                else
-                {
-                    break;
-                }
-            }
-            return nhCount == nhl.getNhlSize();
-        }
-    }
-
-    ostream&
-    operator<<(ostream& os, FibEntry& fe)
-    {
-        os<<"Name Prefix: "<<fe.getName()<<endl;
-        os<<"Time to Refresh: "<<fe.getTimeToRefresh()<<endl;
-        os<<fe.getNhl()<<endl;
-        return os;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_fe.hpp b/src/nlsr_fe.hpp
deleted file mode 100644
index c85e045..0000000
--- a/src/nlsr_fe.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef NLSR_FE_HPP
-#define NLSR_FE_HPP
-
-#include<list>
-#include <iostream>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
-#include "nlsr_nexthop.hpp"
-#include "nlsr_nhl.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class FibEntry
-    {
-    public:
-        FibEntry()
-            : name()
-            , timeToRefresh(0)
-            , feSeqNo(0)
-        {
-        }
-
-        FibEntry(string n)
-        {
-            name=n;
-        }
-
-        string getName()
-        {
-            return name;
-        }
-
-        Nhl& getNhl()
-        {
-            return nhl;
-        }
-
-        int getTimeToRefresh()
-        {
-            return timeToRefresh;
-        }
-
-        void setTimeToRefresh(int ttr)
-        {
-            timeToRefresh=ttr;
-        }
-
-        void setFeExpiringEventId(ndn::EventId feid)
-        {
-            feExpiringEventId=feid;
-        }
-
-        ndn::EventId getFeExpiringEventId()
-        {
-            return feExpiringEventId;
-        }
-
-        void setFeSeqNo(int fsn)
-        {
-            feSeqNo=fsn;
-        }
-
-        int getFeSeqNo()
-        {
-            return feSeqNo;
-        }
-
-        bool isEqualNextHops(Nhl &nhlOther);
-
-    private:
-        string name;
-        int timeToRefresh;
-        ndn::EventId feExpiringEventId;
-        int feSeqNo;
-        Nhl nhl;
-    };
-
-    ostream& operator<<(ostream& os, FibEntry& fe);
-
-} //namespace nlsr
-
-#endif
diff --git a/src/nlsr_fib.cpp b/src/nlsr_fib.cpp
deleted file mode 100644
index 8fb7928..0000000
--- a/src/nlsr_fib.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-#include<list>
-#include "nlsr_fe.hpp"
-#include "nlsr_fib.hpp"
-#include "nlsr_nhl.hpp"
-#include "nlsr.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace ndn;
-
-    static bool
-    fibEntryNameCompare(FibEntry& fe, string name)
-    {
-        return fe.getName() == name ;
-    }
-
-    void
-    Fib::cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid)
-    {
-        pnlsr.getScheduler().cancelEvent(eid);
-    }
-
-
-    ndn::EventId
-    Fib::scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
-                                    int refreshTime)
-    {
-        return pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime),
-                ndn::bind(&Fib::refreshFibEntry,this,name,feSeqNum));
-    }
-
-    void
-    Fib::refreshFibEntry(string name, int feSeqNum)
-    {
-    }
-
-    void
-    Fib::removeFromFib(Nlsr& pnlsr, string name)
-    {
-        std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
-                                            fibTable.end(), bind(&fibEntryNameCompare, _1, name));
-        if( it != fibTable.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);
-        }
-    }
-
-
-    void
-    Fib::updateFib(Nlsr& pnlsr,string name, Nhl& nextHopList, int maxFacesPerPrefix)
-    {
-        int startFace=0;
-        int endFace=getNumberOfFacesForName(nextHopList,maxFacesPerPrefix);
-        std::list<FibEntry >::iterator it = std::find_if( fibTable.begin(),
-                                            fibTable.end(), bind(&fibEntryNameCompare, _1, name));
-        if( it != fibTable.end() )
-        {
-            nextHopList.sortNhl();
-            if ( !(*it).isEqualNextHops(nextHopList) )
-            {
-                std::list<NextHop>::iterator nhit=nextHopList.getNextHopList().begin();
-                (*it).getNhl().addNextHop((*nhit));
-                removeFibEntryHop((*it).getNhl(),(*nhit).getConnectingFace());
-                startFace++;
-                nhit++;
-                for( int i=startFace; i< endFace; nhit++,i++)
-                {
-                    (*it).getNhl().addNextHop((*nhit));
-                }
-                (*it).setTimeToRefresh(fibEntryRefreshTime);
-            }
-            (*it).getNhl().sortNhl();
-            cancelScheduledFeExpiringEvent(pnlsr, (*it).getFeExpiringEventId());
-            (*it).setFeSeqNo((*it).getFeSeqNo()+1);
-            (*it).setFeExpiringEventId(scheduleFibEntryRefreshing(pnlsr,
-                                       (*it).getName() ,
-                                       (*it).getFeSeqNo(),fibEntryRefreshTime));
-            //update NDN-FIB
-        }
-        else
-        {
-            nextHopList.sortNhl();
-            FibEntry newEntry(name);
-            std::list<NextHop>::iterator nhit=nextHopList.getNextHopList().begin();
-            for(int i=startFace; i< endFace ; i++)
-            {
-                newEntry.getNhl().addNextHop((*nhit));
-                ++nhit;
-            }
-            newEntry.getNhl().sortNhl();
-            newEntry.setTimeToRefresh(fibEntryRefreshTime);
-            newEntry.setFeSeqNo(1);
-            fibTable.push_back(newEntry);
-            //cancelScheduledFeExpiringEvent(pnlsr, newEntry().getFeExpiringEventId());
-            //Update NDN-FIB
-        }
-    }
-
-
-
-    void Fib::cleanFib(Nlsr& pnlsr)
-    {
-        for( std::list<FibEntry >::iterator it=fibTable.begin(); it != fibTable.end();
-                ++it)
-        {
-            for(std::list<NextHop>::iterator nhit=(*it).getNhl().getNextHopList().begin();
-                    nhit != (*it).getNhl().getNextHopList().begin(); nhit++)
-            {
-                cancelScheduledFeExpiringEvent(pnlsr,(*it).getFeExpiringEventId());
-                //remove entry from NDN-FIB
-            }
-        }
-        if ( fibTable.size() > 0 )
-        {
-            fibTable.clear();
-        }
-    }
-
-
-    void
-    Fib::removeFibEntryHop(Nhl& nl, int doNotRemoveHopFaceId)
-    {
-        for( std::list<NextHop >::iterator it=nl.getNextHopList().begin();
-                it != nl.getNextHopList().end();   ++it)
-        {
-            if ( (*it).getConnectingFace() != doNotRemoveHopFaceId )
-            {
-                nl.getNextHopList().erase(it);
-            }
-        }
-    }
-
-
-    int
-    Fib::getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix)
-    {
-        int endFace=0;
-        if((maxFacesPerPrefix == 0) || (nextHopList.getNhlSize() <= maxFacesPerPrefix))
-        {
-            return nextHopList.getNhlSize();
-        }
-        else
-        {
-            return maxFacesPerPrefix;
-        }
-        return endFace;
-    }
-
-    void
-    Fib::printFib()
-    {
-        cout<<"-------------------FIB-----------------------------"<<endl;
-        for(std::list<FibEntry>::iterator it = fibTable.begin(); it!=fibTable.end();
-                ++it)
-        {
-            cout<<(*it);
-        }
-    }
-
-} //namespace nlsr
diff --git a/src/nlsr_fib.hpp b/src/nlsr_fib.hpp
deleted file mode 100644
index d93d972..0000000
--- a/src/nlsr_fib.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef NLSR_FIB_HPP
-#define NLSR_FIB_HPP
-
-#include <list>
-#include "nlsr_fe.hpp"
-
-namespace nlsr
-{
-
-    class Nlsr;
-
-    using namespace std;
-    using namespace ndn;
-
-    class Fib
-    {
-    public:
-        Fib()
-        {
-        }
-
-        void removeFromFib(Nlsr& pnlsr, string name);
-        void updateFib(Nlsr& pnlsr, string name, Nhl& nextHopList,
-                       int maxFacesPerPrefix);
-        void cleanFib(Nlsr& pnlsr);
-        void setFibEntryRefreshTime(int fert)
-        {
-            fibEntryRefreshTime=fert;
-        }
-
-        void printFib();
-
-    private:
-        void removeFibEntryHop(Nhl& nl, int doNotRemoveHopFaceId);
-        int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
-        ndn::EventId
-        scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
-                                   int refreshTime);
-        void cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid);
-        void refreshFibEntry(string name, int feSeqNum);
-
-    private:
-        std::list<FibEntry> fibTable;
-        int fibEntryRefreshTime;
-    };
-
-}//namespace nlsr
-#endif
diff --git a/src/nlsr_im.cpp b/src/nlsr_im.cpp
deleted file mode 100644
index 2e6d6d1..0000000
--- a/src/nlsr_im.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-#include<iostream>
-#include<cstdlib>
-
-
-
-#include "nlsr.hpp"
-#include "nlsr_im.hpp"
-#include "nlsr_dm.hpp"
-#include "nlsr_tokenizer.hpp"
-#include "nlsr_lsdb.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace ndn;
-
-    void
-    interestManager::processInterest( Nlsr& pnlsr,
-                                      const ndn::Name &name,
-                                      const ndn::Interest &interest)
-    {
-        cout << "<< I: " << interest << endl;
-        string intName=interest.getName().toUri();
-        cout << "Interest Received for Name: "<< intName <<endl;
-        nlsrTokenizer nt(intName,"/");
-        string chkString("info");
-        if( nt.doesTokenExist(chkString) )
-        {
-            string nbr=nt.getTokenString(nt.getTokenPosition(chkString)+1);
-            cout <<"Neighbor: " << nbr <<endl;
-            processInterestInfo(pnlsr,nbr,interest);
-        }
-        //Data data(ndn::Name(interest->getName()).append("testApp").appendVersion());
-        //data.setFreshnessPeriod(1000); // 10 sec
-        //data.setContent((const uint8_t*)"HELLO KITTY", sizeof("HELLO KITTY"));
-        //pnlsr.getKeyChain().sign(data);
-        //cout << ">> D: " << data << endl;
-        //pnlsr.getNlsrFace().put(data);
-    }
-
-    void
-    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.setContent((const uint8_t*)"info", sizeof("info"));
-            pnlsr.getKeyManager().getKeyChain().sign(data);
-            cout << ">> D: " << data << endl;
-            pnlsr.getNlsrFace().put(data);
-            int status=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
-            if ( status == 0 )
-            {
-                string intName=neighbor +"/"+"info"+
-                               pnlsr.getConfParameter().getRouterPrefix();
-                expressInterest(	pnlsr,intName,2,
-                                    pnlsr.getConfParameter().getInterestResendTime());
-            }
-        }
-    }
-
-    void
-    interestManager::processInterestTimedOut(Nlsr& pnlsr,
-            const ndn::Interest &interest)
-    {
-        cout << "Timed out interest : " << interest.getName().toUri() << endl;
-        string intName=	interest.getName().toUri();
-        nlsrTokenizer nt(intName,"/");
-        string chkString("info");
-        if( nt.doesTokenExist(chkString) )
-        {
-            string nbr="/" + nt.getFirstToken()
-                       +nt.getTokenString(0,nt.getTokenPosition(chkString)-1);
-            processInterestTimedOutInfo( pnlsr , nbr , interest);
-        }
-    }
-
-    void
-    interestManager::processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
-            const ndn::Interest &interest)
-    {
-        pnlsr.getAdl().incrementTimedOutInterestCount(neighbor);
-        int status=pnlsr.getAdl().getStatusOfNeighbor(neighbor);
-        int infoIntTimedOutCount=pnlsr.getAdl().getTimedOutInterestCount(neighbor);
-        cout<<"Neighbor: "<< neighbor << endl;
-        cout<<"Status: "<< status << endl;
-        cout<<"Info Interest Timed out: "<< infoIntTimedOutCount <<endl;
-        if((infoIntTimedOutCount < pnlsr.getConfParameter().getInterestRetryNumber()))
-        {
-            string intName=neighbor +"/"+"info"+
-                           pnlsr.getConfParameter().getRouterPrefix();
-            expressInterest(	pnlsr,intName,2,
-                                pnlsr.getConfParameter().getInterestResendTime());
-        }
-        else if ( (status == 1) &&
-                  (infoIntTimedOutCount == pnlsr.getConfParameter().getInterestRetryNumber()))
-        {
-            pnlsr.getAdl().setStatusOfNeighbor(neighbor,0);
-            pnlsr.incrementAdjBuildCount();
-            if ( pnlsr.getIsBuildAdjLsaSheduled() == 0 )
-            {
-                pnlsr.setIsBuildAdjLsaSheduled(1);
-                // event here
-                pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(5),
-                                                   ndn::bind(&Lsdb::scheduledAdjLsaBuild,pnlsr.getLsdb(),
-                                                           boost::ref(pnlsr)));
-            }
-        }
-    }
-
-    void
-    interestManager::expressInterest(Nlsr& pnlsr,const string& interestNamePrefix,
-                                     int scope, int seconds)
-    {
-        Interest i((ndn::Name(interestNamePrefix)));
-        //i.setScope(scope);
-        i.setInterestLifetime(seconds*1000);
-        i.setMustBeFresh(true);
-        pnlsr.getNlsrFace().expressInterest(i,
-                                            ndn::func_lib::bind(&DataManager::processContent,
-                                                    &pnlsr.getDm(), boost::ref(pnlsr),_1, _2),
-                                            ndn::func_lib::bind(&interestManager::processInterestTimedOut,
-                                                    this,boost::ref(pnlsr),_1));
-    }
-
-
-    void
-    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"+
-                           pnlsr.getConfParameter().getRouterPrefix();
-            expressInterest(	pnlsr,adjName,2,
-                                pnlsr.getConfParameter().getInterestResendTime());
-        }
-        scheduleInfoInterest(pnlsr, pnlsr.getConfParameter().getInfoInterestInterval());
-    }
-
-    void
-    interestManager::scheduleInfoInterest(Nlsr& pnlsr, int seconds)
-    {
-        EventId eid=pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(seconds),
-                    ndn::bind(&interestManager::sendScheduledInfoInterest, this,
-                              boost::ref(pnlsr),seconds));
-    }
-
-
-} //namespace nlsr
diff --git a/src/nlsr_im.hpp b/src/nlsr_im.hpp
deleted file mode 100644
index ccfe78f..0000000
--- a/src/nlsr_im.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef NLSR_IM_HPP
-#define NLSR_IM_HPP
-
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
-namespace nlsr
-{
-
-    using namespace ndn;
-    using namespace std;
-
-    class Nlsr;
-
-    class interestManager
-    {
-    public:
-        interestManager()
-        {
-        }
-        void processInterest(Nlsr& pnlsr, const ndn::Name &name,
-                             const ndn::Interest &interest);
-        void processInterestInfo(Nlsr& pnlsr, string& neighbor,
-                                 const ndn::Interest &interest);
-        void processInterestTimedOut(Nlsr& pnlsr, const ndn::Interest &interest);
-        void processInterestTimedOutInfo(Nlsr& pnlsr, string& neighbor,
-                                         const ndn::Interest &interest);
-        void expressInterest(Nlsr& pnlsr,const string& interestNamePrefix, int scope,
-                             int seconds);
-        void sendScheduledInfoInterest(Nlsr& pnlsr, int seconds);
-        void scheduleInfoInterest(Nlsr& pnlsr, int seconds);
-
-    private:
-
-
-    };
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_km.cpp b/src/nlsr_km.cpp
deleted file mode 100644
index fb4efaa..0000000
--- a/src/nlsr_km.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <ndn-cpp-dev/security/identity-certificate.hpp>
-#include <ndn-cpp-dev/encoding/block.hpp>
-#include "nlsr_km.hpp"
-
-namespace nlsr
-{
-    void
-    KeyManager::initKeyManager(ConfParameter &cp)
-    {
-        ndn::Name identityName(cp.getRouterPrefix()+"/nlsr");
-        kChain.deleteIdentity(identityName);
-        ndn::Name certName = kChain.createIdentity(identityName);
-        cout<<"Certificate Name: "<<certName.toUri()<<endl;
-        ndn::Name keyName=
-            ndn::IdentityCertificate::certificateNameToPublicKeyName(certName);
-        cout<<"Key Name: "<<keyName.toUri()<<endl;
-    }
-
-}
-
-
-
diff --git a/src/nlsr_km.hpp b/src/nlsr_km.hpp
deleted file mode 100644
index e93e996..0000000
--- a/src/nlsr_km.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef NLSR_KM_HPP
-#define NLSR_KM_HPP
-
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
-#include "nlsr_conf_param.hpp"
-
-namespace nlsr
-{
-    class KeyManager
-    {
-    public:
-        KeyManager()
-            :kChain()
-        {
-        }
-
-        ndn::KeyChain& getKeyChain()
-        {
-            return kChain;
-        }
-
-        void initKeyManager(ConfParameter &cp);
-
-    private:
-        ndn::KeyChain kChain;
-    };
-}
-
-#endif
diff --git a/src/nlsr_logger.cpp b/src/nlsr_logger.cpp
deleted file mode 100644
index 804ef98..0000000
--- a/src/nlsr_logger.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "nlsr_logger.hpp"
-
-namespace nlsr
-{
-
-    string
-    NlsrLogger::getEpochTime()
-    {
-        std::stringstream ss;
-        boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
-        boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
-        boost::posix_time::time_duration diff = now - time_t_epoch;
-        ss<<diff.total_seconds()<<"."<<boost::format("%06i")%(diff.total_microseconds()
-                %1000000);
-        return ss.str();
-    }
-
-    string
-    NlsrLogger::getUserHomeDirectory()
-    {
-        string homeDirPath(getpwuid(getuid())->pw_dir);
-        if( homeDirPath.empty() )
-        {
-            homeDirPath = getenv("HOME");
-        }
-        return homeDirPath;
-    }
-
-    void
-    NlsrLogger::initNlsrLogger(std::string dirPath)
-    {
-        string logDirPath(dirPath);
-        if( dirPath.empty() )
-        {
-            logDirPath=getUserHomeDirectory()+"/nlsrLog";
-        }
-        cout<<"Log Dir Path: "<< logDirPath<<endl;
-        typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
-        shared_ptr< file_sink > sink(new file_sink(
-                                         keywords::file_name = logDirPath
-                                                 +"/NLSR%Y%m%d%H%M%S_%3N.log",
-                                         keywords::rotation_size = 128 * 1024 * 1024,
-                                         keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
-                                         keywords::auto_flush = true
-                                     ));
-        sink->locked_backend()->set_file_collector(sinks::file::make_collector(
-                    keywords::target = logDirPath,
-                    keywords::max_size = 16 * 1024 * 1024 * 1024,
-                    keywords::min_free_space = 128 * 1024 * 1024
-                ));
-        sink->set_formatter(
-            expr::format("%1%: %2%")
-            % getEpochTime()
-            % expr::smessage
-        );
-        logging::core::get()->add_sink(sink);
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_logger.hpp b/src/nlsr_logger.hpp
deleted file mode 100644
index 222ac52..0000000
--- a/src/nlsr_logger.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef NLSR_LOGGER_HPP
-#define NLSR_LOGGER_HPP
-
-#define BOOST_LOG_DYN_LINK 1
-
-#include <stdexcept>
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <pwd.h>
-#include <cstdlib>
-#include <string>
-#include <unistd.h>
-#include <boost/format.hpp>
-#include <boost/smart_ptr/shared_ptr.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/date_time/local_time/local_time.hpp>
-#include <boost/log/common.hpp>
-#include <boost/log/expressions.hpp>
-#include <boost/log/attributes.hpp>
-#include <boost/log/sources/logger.hpp>
-#include <boost/log/sinks/sync_frontend.hpp>
-#include <boost/log/sinks/text_file_backend.hpp>
-
-namespace nlsr
-{
-
-    namespace logging = boost::log;
-    namespace attrs = boost::log::attributes;
-    namespace src = boost::log::sources;
-    namespace sinks = boost::log::sinks;
-    namespace expr = boost::log::expressions;
-    namespace keywords = boost::log::keywords;
-
-    using boost::shared_ptr;
-    using namespace std;
-
-
-    class NlsrLogger
-    {
-    public:
-        NlsrLogger()
-        {
-        }
-
-        void initNlsrLogger(std::string dirPath);
-
-        src::logger& getLogger()
-        {
-            return mLogger;
-        }
-
-    private:
-        string getEpochTime();
-        string getUserHomeDirectory();
-
-    private:
-        src::logger mLogger;
-    };
-
-}//namespace nlsr
-#endif
diff --git a/src/nlsr_lsa.cpp b/src/nlsr_lsa.cpp
index f238bce..2a11e41 100644
--- a/src/nlsr_lsa.cpp
+++ b/src/nlsr_lsa.cpp
@@ -1,13 +1,16 @@
 #include<string>
 #include<iostream>
+#include<sstream>
 #include<algorithm>
 #include<cmath>
 #include<limits>
 
+#include "nlsr.hpp"
 #include "nlsr_lsa.hpp"
 #include "nlsr_npl.hpp"
 #include "nlsr_adjacent.hpp"
-#include "nlsr.hpp"
+#include "utility/nlsr_tokenizer.hpp"
+
 
 namespace nlsr
 {
@@ -40,7 +43,7 @@
     NameLsa::getNameLsaData()
     {
         string nameLsaData;
-        nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(lsType) + "|"
+        nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(1) + "|"
                     + boost::lexical_cast<std::string>(lsSeqNo) + "|"
                     + boost::lexical_cast<std::string>(lifeTime);
         nameLsaData+="|";
@@ -51,7 +54,36 @@
             nameLsaData+="|";
             nameLsaData+=(*it);
         }
-        return nameLsaData;
+        return nameLsaData+"|";
+    }
+
+    bool
+    NameLsa::initNameLsaFromContent(string content)
+    {
+        uint32_t numName=0;
+        nlsrTokenizer nt(content, "|");
+        origRouter=nt.getNextToken();
+        if(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());
+            numName=boost::lexical_cast<uint32_t>(nt.getNextToken());
+        }
+        catch(std::exception &e)
+        {
+            return false;
+        }
+        for(int i=0; i<numName; i++)
+        {
+            string name=nt.getNextToken();
+            addNameToLsa(name);
+        }
+        return true;
     }
 
     std::ostream&
@@ -107,7 +139,7 @@
     {
         string corLsaData;
         corLsaData=origRouter + "|";
-        corLsaData+=(boost::lexical_cast<std::string>(lsType) + "|");
+        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) + "|");
@@ -115,6 +147,30 @@
         return corLsaData;
     }
 
+    bool
+    CorLsa::initCorLsaFromContent(string content)
+    {
+        nlsrTokenizer nt(content, "|");
+        origRouter=nt.getNextToken();
+        if(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());
+        }
+        catch(std::exception &e)
+        {
+            return false;
+        }
+        return true;
+    }
+
     std::ostream&
     operator<<(std::ostream& os, CorLsa& cLsa)
     {
@@ -166,7 +222,7 @@
     AdjLsa::getAdjLsaData()
     {
         string adjLsaData;
-        adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(lsType) + "|"
+        adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(2) + "|"
                    + boost::lexical_cast<std::string>(lsSeqNo) + "|"
                    + boost::lexical_cast<std::string>(lifeTime);
         adjLsaData+="|";
@@ -181,7 +237,46 @@
             adjLsaData+="|";
             adjLsaData+=boost::lexical_cast<std::string>((*it).getLinkCost());
         }
-        return adjLsaData;
+        return adjLsaData+"|";
+    }
+
+    bool
+    AdjLsa::initAdjLsaFromContent(string content)
+    {
+        uint32_t numLink=0;
+        nlsrTokenizer nt(content, "|");
+        origRouter=nt.getNextToken();
+        if(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());
+            numLink=boost::lexical_cast<uint32_t>(nt.getNextToken());
+        }
+        catch(std::exception &e)
+        {
+            return false;
+        }
+        for(int i=0; i< numLink; i++)
+        {
+            try
+            {
+                string adjName=nt.getNextToken();
+                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);
+            }
+            catch( std::exception &e )
+            {
+                return false;
+            }
+        }
+        return true;
     }
 
 
diff --git a/src/nlsr_lsa.hpp b/src/nlsr_lsa.hpp
index 24bf73d..a0968f1 100644
--- a/src/nlsr_lsa.hpp
+++ b/src/nlsr_lsa.hpp
@@ -113,6 +113,7 @@
         string getNameLsaKey();
 
         string getNameLsaData();
+        bool initNameLsaFromContent(string content);
 
     private:
         Npl npl;
@@ -145,6 +146,7 @@
         }
         string getAdjLsaKey();
         string getAdjLsaData();
+        bool initAdjLsaFromContent(string content);
         uint32_t getNoLink()
         {
             return noLink;
@@ -166,7 +168,9 @@
     {
     public:
         CorLsa()
-            :Lsa()
+            : Lsa()
+            , corRad(0)
+            , corTheta(0)
         {
             setLsType(3);
         }
@@ -175,7 +179,7 @@
                , double r, double theta);
         string getCorLsaKey();
         string getCorLsaData();
-
+        bool initCorLsaFromContent(string content);
         double getCorRadius()
         {
             if ( corRad >= 0 )
diff --git a/src/nlsr_lsdb.cpp b/src/nlsr_lsdb.cpp
index cd80809..cada99d 100644
--- a/src/nlsr_lsdb.cpp
+++ b/src/nlsr_lsdb.cpp
@@ -47,6 +47,23 @@
         return std::make_pair(boost::ref(nlsa),false);
     }
 
+    bool
+    Lsdb::isNameLsaNew(string key, uint64_t seqNo)
+    {
+        std::pair<NameLsa& , bool>  nameLsaCheck=getNameLsa(key);
+        if(nameLsaCheck.second)
+        {
+            if(nameLsaCheck.first.getLsSeqNo() < seqNo)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        return true;
+    }
 
     ndn::EventId
     Lsdb::scheduleNameLsaExpiration(Nlsr& pnlsr, string key, int seqNo, int expTime)
@@ -241,6 +258,24 @@
         return std::make_pair(boost::ref(clsa),false);
     }
 
+    bool
+    Lsdb::isCorLsaNew(string key, uint64_t seqNo)
+    {
+        std::pair<CorLsa& , bool>  corLsaCheck=getCorLsa(key);
+        if(corLsaCheck.second)
+        {
+            if(corLsaCheck.first.getLsSeqNo() < seqNo)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
     ndn::EventId
     Lsdb::scheduleCorLsaExpiration(Nlsr& pnlsr, string key, int seqNo, int expTime)
     {
@@ -432,6 +467,24 @@
     }
 
 
+    bool
+    Lsdb::isAdjLsaNew(string key, uint64_t seqNo)
+    {
+        std::pair<AdjLsa& , bool>  adjLsaCheck=getAdjLsa(key);
+        if(adjLsaCheck.second)
+        {
+            if(adjLsaCheck.first.getLsSeqNo() < seqNo)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
 
     ndn::EventId
     Lsdb::scheduleAdjLsaExpiration(Nlsr& pnlsr, string key, int seqNo, int expTime)
@@ -480,7 +533,6 @@
                                                       alsa.getAdjLsaKey(), alsa.getLsSeqNo(),timeToExpire));
             }
         }
-        printAdjLsdb();
         return true;
     }
 
@@ -494,7 +546,10 @@
                       , pnlsr.getAdl().getNumOfActiveNeighbor()
                       , pnlsr.getAdl() );
         pnlsr.getSm().setAdjLsaSeq(pnlsr.getSm().getAdjLsaSeq()+1);
-        return installAdjLsa(pnlsr, adjLsa);
+        string lsaPrefix=pnlsr.getConfParameter().getChronosyncLsaPrefix()
+                         + pnlsr.getConfParameter().getRouterPrefix();
+        pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(),lsaPrefix);
+        return pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
     }
 
     bool
@@ -547,7 +602,7 @@
     Lsdb::exprireOrRefreshNameLsa(Nlsr& pnlsr, string lsaKey, int seqNo)
     {
         cout<<"Lsdb::exprireOrRefreshNameLsa Called "<<endl;
-        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<endl;
+        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<seqNo<<endl;
         std::pair<NameLsa& , bool> chkNameLsa=getNameLsa(lsaKey);
         if( chkNameLsa.second )
         {
@@ -560,6 +615,9 @@
                     chkNameLsa.first.setLsSeqNo(chkNameLsa.first.getLsSeqNo()+1);
                     pnlsr.getSm().setNameLsaSeq(chkNameLsa.first.getLsSeqNo());
                     // publish routing update
+                    string lsaPrefix=pnlsr.getConfParameter().getChronosyncLsaPrefix()
+                                     + pnlsr.getConfParameter().getRouterPrefix();
+                    pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(),lsaPrefix);
                 }
                 else
                 {
@@ -574,7 +632,7 @@
     Lsdb::exprireOrRefreshAdjLsa(Nlsr& pnlsr, string lsaKey, int seqNo)
     {
         cout<<"Lsdb::exprireOrRefreshAdjLsa Called "<<endl;
-        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<endl;
+        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<seqNo<<endl;
         std::pair<AdjLsa& , bool> chkAdjLsa=getAdjLsa(lsaKey);
         if( chkAdjLsa.second )
         {
@@ -587,6 +645,9 @@
                     chkAdjLsa.first.setLsSeqNo(chkAdjLsa.first.getLsSeqNo()+1);
                     pnlsr.getSm().setAdjLsaSeq(chkAdjLsa.first.getLsSeqNo());
                     // publish routing update
+                    string lsaPrefix=pnlsr.getConfParameter().getChronosyncLsaPrefix()
+                                     + pnlsr.getConfParameter().getRouterPrefix();
+                    pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(),lsaPrefix);
                 }
                 else
                 {
@@ -603,7 +664,7 @@
     Lsdb::exprireOrRefreshCorLsa(Nlsr& pnlsr, string lsaKey, int seqNo)
     {
         cout<<"Lsdb::exprireOrRefreshCorLsa Called "<<endl;
-        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<endl;
+        cout<<"LSA Key : "<<lsaKey<<" Seq No: "<<seqNo<<endl;
         std::pair<CorLsa& , bool> chkCorLsa=getCorLsa(lsaKey);
         if( chkCorLsa.second )
         {
@@ -616,6 +677,9 @@
                     chkCorLsa.first.setLsSeqNo(chkCorLsa.first.getLsSeqNo()+1);
                     pnlsr.getSm().setCorLsaSeq(chkCorLsa.first.getLsSeqNo());
                     // publish routing update
+                    string lsaPrefix=pnlsr.getConfParameter().getChronosyncLsaPrefix()
+                                     + pnlsr.getConfParameter().getRouterPrefix();
+                    pnlsr.getSlh().publishRoutingUpdate(pnlsr.getSm(),lsaPrefix);
                 }
                 else
                 {
diff --git a/src/nlsr_lsdb.hpp b/src/nlsr_lsdb.hpp
index 93b2f10..6862224 100644
--- a/src/nlsr_lsdb.hpp
+++ b/src/nlsr_lsdb.hpp
@@ -26,6 +26,7 @@
         std::pair<NameLsa&, bool>  getNameLsa(string key);
         bool installNameLsa(Nlsr& pnlsr, NameLsa &nlsa);
         bool removeNameLsa(Nlsr& pnlsr, string& key);
+        bool isNameLsaNew(string key, uint64_t seqNo);
         void printNameLsdb(); //debugging
 
         //function related to Cor LSDB
@@ -33,12 +34,14 @@
         std::pair<CorLsa&, bool> getCorLsa(string key);
         bool installCorLsa(Nlsr& pnlsr, CorLsa &clsa);
         bool removeCorLsa(Nlsr& pnlsr, string& key);
+        bool isCorLsaNew(string key, uint64_t seqNo);
         void printCorLsdb(); //debugging
 
         //function related to Adj LSDB
         void scheduledAdjLsaBuild(Nlsr& pnlsr);
         bool buildAndInstallOwnAdjLsa(Nlsr& pnlsr);
         bool removeAdjLsa(Nlsr& pnlsr, string& key);
+        bool isAdjLsaNew(string key, uint64_t seqNo);
         bool installAdjLsa(Nlsr& pnlsr, AdjLsa &alsa);
         std::pair<AdjLsa& , bool> getAdjLsa(string key);
         std::list<AdjLsa>& getAdjLsdb();
diff --git a/src/nlsr_map.cpp b/src/nlsr_map.cpp
deleted file mode 100644
index 47b02ec..0000000
--- a/src/nlsr_map.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#include<iostream>
-#include<list>
-
-#include "nlsr.hpp"
-#include "nlsr_adjacent.hpp"
-#include "nlsr_lsa.hpp"
-#include "nlsr_lsdb.hpp"
-#include "nlsr_map.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    ostream&
-    operator<<(ostream& os, MapEntry& mpe)
-    {
-        os<<"MapEntry: ( Router: "<<mpe.getRouter()<<" Mapping No: ";
-        os<<mpe.getMappingNumber()<<" )"<<endl;
-        return os;
-    }
-
-    static bool
-    mapEntryCompareByRouter(MapEntry& mpe1, string& rtrName)
-    {
-        return mpe1.getRouter()==rtrName;
-    }
-
-    static bool
-    mapEntryCompareByMappingNo(MapEntry& mpe1, int mappingNo)
-    {
-        return mpe1.getMappingNumber()==mappingNo;
-    }
-
-    void
-    Map::addMapElement(string& rtrName)
-    {
-        MapEntry me(rtrName,mappingIndex);
-        if (  addMapElement(me) )
-        {
-            mappingIndex++;
-        }
-    }
-
-    bool
-    Map::addMapElement(MapEntry& mpe)
-    {
-        //cout << mpe;
-        std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                            rMap.end(),
-                                            bind(&mapEntryCompareByRouter, _1, mpe.getRouter()));
-        if ( it == rMap.end() )
-        {
-            rMap.push_back(mpe);
-            return true;
-        }
-        return false;
-    }
-
-    string
-    Map::getRouterNameByMappingNo(int mn)
-    {
-        std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                            rMap.end(),
-                                            bind(&mapEntryCompareByMappingNo, _1, mn));
-        if ( it != rMap.end() )
-        {
-            return (*it).getRouter();
-        }
-        return "";
-    }
-
-    int
-    Map::getMappingNoByRouterName(string& rName)
-    {
-        std::list<MapEntry >::iterator it = std::find_if( rMap.begin(),
-                                            rMap.end(),
-                                            bind(&mapEntryCompareByRouter, _1, rName));
-        if ( it != rMap.end() )
-        {
-            return (*it).getMappingNumber();
-        }
-        return -1;
-    }
-
-    void
-    Map::createMapFromAdjLsdb(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);
-            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);
-            }
-        }
-    }
-
-    void
-    Map::resetMap()
-    {
-        rMap.clear();
-        mappingIndex=0;
-    }
-
-    ostream&
-    operator<<(ostream& os, Map& rMap)
-    {
-        os<<"---------------Map----------------------"<<endl;
-        std::list< MapEntry > ml=rMap.getMapList();
-        for( std::list<MapEntry>::iterator it=ml.begin(); it!= ml.end() ; it++)
-        {
-            os<< (*it);
-        }
-        return os;
-    }
-
-} //namespace nlsr
diff --git a/src/nlsr_map.hpp b/src/nlsr_map.hpp
deleted file mode 100644
index 0352d1d..0000000
--- a/src/nlsr_map.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef NLSR_MAP_HPP
-#define NLSR_MAP_HPP
-
-#include <iostream>
-#include <list>
-
-#include <ndn-cpp-dev/face.hpp>
-
-namespace nlsr
-{
-
-    class Nlsr;
-
-    using namespace std;
-
-    class MapEntry
-    {
-    public:
-        MapEntry()
-            : router()
-            , mappingNumber(-1)
-        {
-        }
-
-        ~MapEntry()
-        {
-        }
-
-        MapEntry(string rtr, int mn)
-        {
-            router=rtr;
-            mappingNumber=mn;
-        }
-
-        string getRouter()
-        {
-            return router;
-        }
-
-        int getMappingNumber()
-        {
-            return mappingNumber;
-        }
-    private:
-        string router;
-        int mappingNumber;
-    };
-
-    ostream&
-    operator<<(ostream& os, MapEntry& mpe);
-
-    class Map
-    {
-    public:
-        Map()
-            : mappingIndex(0)
-        {
-        }
-
-
-        void addMapElement(string& rtrName);
-        void createMapFromAdjLsdb(Nlsr& pnlsr);
-        string getRouterNameByMappingNo(int mn);
-        int getMappingNoByRouterName(string& rName);
-        void resetMap();
-        std::list< MapEntry >& getMapList()
-        {
-            return rMap;
-        }
-
-        int getMapSize()
-        {
-            return rMap.size();
-        }
-
-
-    private:
-        bool addMapElement(MapEntry& mpe);
-
-        int mappingIndex;
-        std::list< MapEntry > rMap;
-    };
-
-    ostream&
-    operator<<(ostream& os, Map& rMap);
-
-} // namespace nlsr
-#endif
diff --git a/src/nlsr_nexthop.cpp b/src/nlsr_nexthop.cpp
deleted file mode 100644
index e58b23c..0000000
--- a/src/nlsr_nexthop.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "nlsr_nexthop.hpp"
-
-namespace nlsr
-{
-
-    ostream&
-    operator<<(ostream& os, NextHop& nh)
-    {
-        os<<"Face: "<<nh.getConnectingFace()<<"  Route Cost: "<<nh.getRouteCost();
-        return os;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_nexthop.hpp b/src/nlsr_nexthop.hpp
deleted file mode 100644
index 1361d52..0000000
--- a/src/nlsr_nexthop.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef NLSR_NEXTHOP_HPP
-#define NLSR_NEXTHOP_HPP
-
-#include<iostream>
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class NextHop
-    {
-    public:
-        NextHop()
-            : connectingFace(0)
-            , routeCost(0)
-        {
-        }
-
-        NextHop(int cf, double rc)
-        {
-            connectingFace=cf;
-            routeCost=rc;
-        }
-
-        int getConnectingFace()
-        {
-            return connectingFace;
-        }
-
-        void setConnectingFace(int cf)
-        {
-            connectingFace=cf;
-        }
-
-        double getRouteCost()
-        {
-            return routeCost;
-        }
-
-        void setRouteCost(double rc)
-        {
-            routeCost=rc;
-        }
-    private:
-        int connectingFace;
-        double routeCost;
-    };
-
-
-    ostream&
-    operator<<(ostream& os, NextHop& nh);
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_nhl.cpp b/src/nlsr_nhl.cpp
deleted file mode 100644
index 2aaa2a6..0000000
--- a/src/nlsr_nhl.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <iostream>
-
-#include "nlsr_nhl.hpp"
-#include "nlsr_nexthop.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    static bool
-    nexthopCompare(NextHop& nh1, NextHop& nh2)
-    {
-        return nh1.getConnectingFace()==nh2.getConnectingFace();
-    }
-
-    static bool
-    nexthopRemoveCompare(NextHop& nh1, NextHop& nh2)
-    {
-        return (nh1.getConnectingFace()==nh2.getConnectingFace() &&
-                nh1.getRouteCost() == nh2.getRouteCost()) ;
-    }
-
-    static bool
-    nextHopSortingComparator(NextHop& nh1, NextHop& nh2)
-    {
-        return nh1.getRouteCost() < nh2.getRouteCost();
-    }
-
-    /**
-    Add next hop to the Next Hop list
-    If next hop is new it is added
-    If next hop already exists in next
-    hop list then updates the route
-    cost with new next hop's route cost
-    */
-
-    void
-    Nhl::addNextHop(NextHop& nh)
-    {
-        std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
-                                           nexthopList.end(),
-                                           bind(&nexthopCompare, _1, nh));
-        if ( it == nexthopList.end() )
-        {
-            nexthopList.push_back(nh);
-        }
-        if ( (*it).getRouteCost() > nh.getRouteCost() )
-        {
-            (*it).setRouteCost(nh.getRouteCost());
-        }
-    }
-
-    /**
-    Remove a next hop only if both next hop face and route cost are same
-
-    */
-
-    void
-    Nhl::removeNextHop(NextHop &nh)
-    {
-        std::list<NextHop >::iterator it = std::find_if( nexthopList.begin(),
-                                           nexthopList.end(),
-                                           bind(&nexthopRemoveCompare, _1, nh));
-        if ( it != nexthopList.end() )
-        {
-            nexthopList.erase(it);
-        }
-    }
-
-    void
-    Nhl::sortNhl()
-    {
-        nexthopList.sort(nextHopSortingComparator);
-    }
-
-    ostream&
-    operator<<(ostream& os, Nhl& nhl)
-    {
-        std::list< NextHop > nexthopList = nhl.getNextHopList();
-        int i=1;
-        for( std::list<NextHop>::iterator it=nexthopList.begin();
-                it!= nexthopList.end() ; it++,i++)
-        {
-            os << "Nexthop "<<i<<": "<<(*it)<<endl;
-        }
-        return os;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_nhl.hpp b/src/nlsr_nhl.hpp
deleted file mode 100644
index 9f6bd76..0000000
--- a/src/nlsr_nhl.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef NLSR_NHL_HPP
-#define NLSR_NHL_HPP
-
-#include <ndn-cpp-dev/face.hpp>
-#include "nlsr_adjacent.hpp"
-#include <list>
-#include <iostream>
-
-#include "nlsr_nexthop.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class Nhl
-    {
-    public:
-        Nhl()
-        {
-        }
-
-        ~Nhl()
-        {
-        }
-        void addNextHop(NextHop &nh);
-        void removeNextHop(NextHop &nh);
-        void sortNhl();
-        int getNhlSize()
-        {
-            return nexthopList.size();
-        }
-        void resetNhl()
-        {
-            if (nexthopList.size() > 0 )
-            {
-                nexthopList.clear();
-            }
-        }
-        std::list< NextHop >& getNextHopList()
-        {
-            return nexthopList;
-        }
-
-    private:
-        std::list< NextHop > nexthopList;
-    };
-
-    ostream&
-    operator<<(ostream& os, Nhl& nhl);
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_npt.cpp b/src/nlsr_npt.cpp
deleted file mode 100644
index 9c4d4cb..0000000
--- a/src/nlsr_npt.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-#include <list>
-#include <utility>
-#include <algorithm>
-
-#include "nlsr_npt.hpp"
-#include "nlsr_npte.hpp"
-#include "nlsr.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    static bool
-    npteCompare(Npte& npte, string& name)
-    {
-        return npte.getNamePrefix()==name;
-    }
-
-// Following two methods will update FIB with response to change in NPT
-
-    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() )
-        {
-            Npte newEntry(	name);
-            newEntry.addRoutingTableEntry(rte);
-            newEntry.generateNhlfromRteList();
-            npteList.push_back(newEntry);
-            // update FIB here with nhl list newEntry.getNhl()
-            pnlsr.getFib().updateFib(pnlsr, name,newEntry.getNhl(),
-                                     pnlsr.getConfParameter().getMaxFacesPerPrefix());
-        }
-        else
-        {
-            (*it).addRoutingTableEntry(rte);
-            (*it).generateNhlfromRteList();
-            // update FIB here with nhl list from (*it).getNhl()
-            pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl() ,
-                                     pnlsr.getConfParameter().getMaxFacesPerPrefix());
-        }
-    }
-
-    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() )
-        {
-            string destRouter=rte.getDestination();
-            (*it).removeRoutingTableEntry(rte);
-            if ( ((*it).getRteListSize() == 0 ) &&
-                    (!pnlsr.getLsdb().doesLsaExist(destRouter+"/1",1) ) &&
-                    (!pnlsr.getLsdb().doesLsaExist(destRouter+"/2",2) ) &&
-                    (!pnlsr.getLsdb().doesLsaExist(destRouter+"/3",3) )   )
-            {
-                npteList.erase(it); // remove entry from NPT
-                // remove FIB entry with this name
-                pnlsr.getFib().removeFromFib(pnlsr,name);
-            }
-            else
-            {
-                (*it).generateNhlfromRteList();
-                // update FIB entry with new NHL
-                pnlsr.getFib().updateFib(pnlsr, name,(*it).getNhl(),
-                                         pnlsr.getConfParameter().getMaxFacesPerPrefix());
-            }
-        }
-    }
-
-
-    void
-    Npt::addNpte(string name, string destRouter, Nlsr& pnlsr)
-    {
-        std::pair<RoutingTableEntry& , bool> rteCheck=
-            pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
-        if(rteCheck.second)
-        {
-            addNpte(name,rteCheck.first,pnlsr);
-        }
-        else
-        {
-            RoutingTableEntry rte(destRouter);
-            addNpte(name, rte,pnlsr);
-        }
-    }
-
-    void
-    Npt::removeNpte(string name, string destRouter, Nlsr& pnlsr)
-    {
-        std::pair<RoutingTableEntry& , bool> rteCheck=
-            pnlsr.getRoutingTable().findRoutingTableEntry(destRouter);
-        if(rteCheck.second)
-        {
-            removeNpte(name,rteCheck.first,pnlsr);
-        }
-        else
-        {
-            RoutingTableEntry rte(destRouter);
-            removeNpte(name, rte,pnlsr);
-        }
-    }
-
-    void
-    Npt::updateNptWithNewRoute(Nlsr& pnlsr)
-    {
-        for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
-        {
-            std::list<RoutingTableEntry> rteList=(*it).getRteList();
-            for(std::list<RoutingTableEntry >::iterator rteit=rteList.begin();
-                    rteit !=rteList.end(); ++rteit)
-            {
-                std::pair<RoutingTableEntry& , bool> rteCheck=
-                    pnlsr.getRoutingTable().findRoutingTableEntry((*rteit).getDestination());
-                if(rteCheck.second)
-                {
-                    addNpte((*it).getNamePrefix(),rteCheck.first,pnlsr);
-                }
-                else
-                {
-                    RoutingTableEntry rte((*rteit).getDestination());
-                    addNpte((*it).getNamePrefix(), rte,pnlsr);
-                }
-            }
-        }
-    }
-
-    void
-    Npt::printNpt()
-    {
-        cout<<"----------------NPT----------------------"<<endl;
-        for(std::list<Npte >::iterator it=npteList.begin(); it!=npteList.end(); ++it)
-        {
-            cout <<(*it)<<endl;
-        }
-    }
-
-}
diff --git a/src/nlsr_npt.hpp b/src/nlsr_npt.hpp
deleted file mode 100644
index f4ddbf9..0000000
--- a/src/nlsr_npt.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef NLSR_NPT_HPP
-#define NLSR_NPT_HPP
-
-#include <list>
-#include "nlsr_npte.hpp"
-#include "nlsr_rte.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class Nlsr;
-
-    class Npt
-    {
-    public:
-        Npt()
-        {
-        }
-        void addNpte(string name, string destRouter, Nlsr& pnlsr);
-        void removeNpte(string name, string destRouter, Nlsr& pnlsr);
-        void updateNptWithNewRoute(Nlsr& pnlsr);
-        void printNpt();
-    private:
-        void addNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
-        void removeNpte(string name, RoutingTableEntry& rte, Nlsr& pnlsr);
-    private:
-        std::list<Npte> npteList;
-    };
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_npte.cpp b/src/nlsr_npte.cpp
deleted file mode 100644
index 60013ff..0000000
--- a/src/nlsr_npte.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <list>
-#include <utility>
-#include "nlsr_npte.hpp"
-#include "nlsr_rte.hpp"
-#include "nlsr_nexthop.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    void
-    Npte::generateNhlfromRteList()
-    {
-        nhl.resetNhl();
-        for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
-                it != rteList.end(); ++it )
-        {
-            for(std::list< NextHop >::iterator nhit=(*it).getNhl().getNextHopList().begin();
-                    nhit != (*it).getNhl().getNextHopList().end(); ++nhit)
-            {
-                nhl.addNextHop((*nhit));
-            }
-        }
-    }
-
-
-
-    static bool
-    rteCompare(RoutingTableEntry& rte, string& destRouter)
-    {
-        return rte.getDestination()==destRouter;
-    }
-
-    void
-    Npte::removeRoutingTableEntry(RoutingTableEntry& rte)
-    {
-        std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
-                rteList.end(),
-                bind(&rteCompare, _1, rte.getDestination()));
-        if ( it != rteList.end() )
-        {
-            rteList.erase(it);
-        }
-    }
-
-    void
-    Npte::addRoutingTableEntry(RoutingTableEntry &rte)
-    {
-        std::list<RoutingTableEntry >::iterator it = std::find_if( rteList.begin(),
-                rteList.end(),
-                bind(&rteCompare, _1, rte.getDestination()));
-        if ( it == rteList.end() )
-        {
-            rteList.push_back(rte);
-        }
-        else
-        {
-            (*it).getNhl().resetNhl(); // reseting existing routing table's next hop
-            for(std::list< NextHop >::iterator nhit=rte.getNhl().getNextHopList().begin();
-                    nhit != rte.getNhl().getNextHopList().end(); ++nhit)
-            {
-                (*it).getNhl().addNextHop((*nhit));
-            }
-        }
-    }
-
-//debugging purpose
-    ostream&
-    operator<<(ostream& os, Npte& npte)
-    {
-        os<<"Name: "<<npte.getNamePrefix()<<endl;
-        std::list<RoutingTableEntry> rteList=npte.getRteList();
-        for(std::list<RoutingTableEntry >::iterator it=rteList.begin();
-                it !=rteList.end(); ++it)
-        {
-            cout<<(*it);
-        }
-        os<<npte.getNhl();
-        return os;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_npte.hpp b/src/nlsr_npte.hpp
deleted file mode 100644
index e64328c..0000000
--- a/src/nlsr_npte.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef NLSR_NPTE_HPP
-#define NLSR_NPTE_HPP
-
-#include <list>
-#include <utility>
-#include "nlsr_rte.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class Npte
-    {
-    public:
-        Npte()
-            : namePrefix()
-            , nhl()
-        {
-        }
-        Npte(string np)
-            : nhl()
-        {
-            namePrefix=np;
-        }
-
-        string getNamePrefix()
-        {
-            return namePrefix;
-        }
-
-        std::list<RoutingTableEntry>& getRteList()
-        {
-            return rteList;
-        }
-
-        int getRteListSize()
-        {
-            return rteList.size();
-        }
-
-        Nhl& getNhl()
-        {
-            return nhl;
-        }
-        void generateNhlfromRteList();
-        void removeRoutingTableEntry(RoutingTableEntry& rte);
-        void addRoutingTableEntry(RoutingTableEntry &rte);
-
-    private:
-        string namePrefix;
-        std::list<RoutingTableEntry> rteList;
-        Nhl nhl;
-    };
-
-    ostream&
-    operator<<(ostream& os, Npte& npte);
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_rt.cpp b/src/nlsr_rt.cpp
deleted file mode 100644
index 87dcd26..0000000
--- a/src/nlsr_rt.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-#include<iostream>
-#include<string>
-#include<list>
-
-#include "nlsr_rt.hpp"
-#include "nlsr.hpp"
-#include "nlsr_map.hpp"
-#include "nlsr_rtc.hpp"
-#include "nlsr_rte.hpp"
-#include "nlsr_npt.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    void
-    RoutingTable::calculate(Nlsr& pnlsr)
-    {
-        //debugging purpose
-        pnlsr.getNpt().printNpt();
-        if ( 	pnlsr.getIsRoutingTableCalculating() == 0 )
-        {
-            pnlsr.setIsRoutingTableCalculating(1); //setting routing table calculation
-            if ( pnlsr.getLsdb().doesLsaExist(
-                        pnlsr.getConfParameter().getRouterPrefix()+"/"+"2",2) )
-            {
-                if(pnlsr.getIsBuildAdjLsaSheduled() != 1)
-                {
-                    cout<<"CLearing old routing table ....."<<endl;
-                    clearRoutingTable();
-                    clearDryRoutingTable(); // for dry run options
-                    // calculate Link State routing
-                    if( (pnlsr.getConfParameter().getIsHyperbolicCalc() == 0 )
-                            || (pnlsr.getConfParameter().getIsHyperbolicCalc() == 2 ) )
-                    {
-                        calculateLsRoutingTable(pnlsr);
-                    }
-                    //calculate hyperbolic routing
-                    if ( pnlsr.getConfParameter().getIsHyperbolicCalc() == 1 )
-                    {
-                        calculateHypRoutingTable(pnlsr);
-                    }
-                    //calculate dry hyperbolic routing
-                    if ( pnlsr.getConfParameter().getIsHyperbolicCalc() == 2 )
-                    {
-                        calculateHypDryRoutingTable(pnlsr);
-                    }
-                    //need to update NPT here
-                    pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
-                    //debugging purpose
-                    printRoutingTable();
-                    pnlsr.getNpt().printNpt();
-                    pnlsr.getFib().printFib();
-                    //debugging purpose end
-                }
-                else
-                {
-                    cout<<"Adjacency building is scheduled, so ";
-                    cout<<"routing table can not be calculated :("<<endl;
-                }
-            }
-            else
-            {
-                cout<<"No Adj LSA of router itself,";
-                cout<<	" so Routing table can not be calculated :("<<endl;
-                clearRoutingTable();
-                clearDryRoutingTable(); // for dry run options
-                // need to update NPT here
-                pnlsr.getNpt().updateNptWithNewRoute(pnlsr);
-                //debugging purpose
-                printRoutingTable();
-                pnlsr.getNpt().printNpt();
-                pnlsr.getFib().printFib();
-                //debugging purpose end
-            }
-            pnlsr.setIsRouteCalculationScheduled(0); //clear scheduled flag
-            pnlsr.setIsRoutingTableCalculating(0); //unsetting routing table calculation
-        }
-        else
-        {
-            scheduleRoutingTableCalculation(pnlsr);
-        }
-    }
-
-
-    void
-    RoutingTable::calculateLsRoutingTable(Nlsr& pnlsr)
-    {
-        cout<<"RoutingTable::calculateLsRoutingTable Called"<<endl;
-        Map vMap;
-        vMap.createMapFromAdjLsdb(pnlsr);
-        int numOfRouter=vMap.getMapSize();
-        LinkStateRoutingTableCalculator lsrtc(numOfRouter);
-        lsrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
-    }
-
-    void
-    RoutingTable::calculateHypRoutingTable(Nlsr& pnlsr)
-    {
-        Map vMap;
-        vMap.createMapFromAdjLsdb(pnlsr);
-        int numOfRouter=vMap.getMapSize();
-        HypRoutingTableCalculator hrtc(numOfRouter,0);
-        hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
-    }
-
-    void
-    RoutingTable::calculateHypDryRoutingTable(Nlsr& pnlsr)
-    {
-        Map vMap;
-        vMap.createMapFromAdjLsdb(pnlsr);
-        int numOfRouter=vMap.getMapSize();
-        HypRoutingTableCalculator hrtc(numOfRouter,1);
-        hrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
-    }
-
-    void
-    RoutingTable::scheduleRoutingTableCalculation(Nlsr& pnlsr)
-    {
-        if ( pnlsr.getIsRouteCalculationScheduled() != 1 )
-        {
-            pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(15),
-                                               ndn::bind(&RoutingTable::calculate,this,boost::ref(pnlsr)));
-            pnlsr.setIsRouteCalculationScheduled(1);
-        }
-    }
-
-    static bool
-    routingTableEntryCompare(RoutingTableEntry& rte, string& destRouter)
-    {
-        return rte.getDestination()==destRouter;
-    }
-
-// function related to manipulation of routing table
-    void
-    RoutingTable::addNextHop(string destRouter, NextHop& nh)
-    {
-        std::pair<RoutingTableEntry&, bool> rte=findRoutingTableEntry(destRouter);
-        if( !rte.second )
-        {
-            RoutingTableEntry rte(destRouter);
-            rte.getNhl().addNextHop(nh);
-            rTable.push_back(rte);
-        }
-        else
-        {
-            (rte.first).getNhl().addNextHop(nh);
-        }
-    }
-
-    std::pair<RoutingTableEntry&, bool>
-    RoutingTable::findRoutingTableEntry(string destRouter)
-    {
-        std::list<RoutingTableEntry >::iterator it = std::find_if( rTable.begin(),
-                rTable.end(),
-                bind(&routingTableEntryCompare, _1, destRouter));
-        if ( it != rTable.end() )
-        {
-            return std::make_pair(boost::ref((*it)),true);
-        }
-        RoutingTableEntry rteEmpty;
-        return std::make_pair(boost::ref(rteEmpty),false);
-    }
-
-    void
-    RoutingTable::printRoutingTable()
-    {
-        cout<<"---------------Routing Table------------------"<<endl;
-        for(std::list<RoutingTableEntry>::iterator it=rTable.begin() ;
-                it != rTable.end(); ++it)
-        {
-            cout<<(*it)<<endl;
-        }
-    }
-
-
-//function related to manipulation of dry routing table
-    void
-    RoutingTable::addNextHopToDryTable(string destRouter, NextHop& nh)
-    {
-        std::list<RoutingTableEntry >::iterator it = std::find_if( dryTable.begin(),
-                dryTable.end(),
-                bind(&routingTableEntryCompare, _1, destRouter));
-        if ( it == dryTable.end() )
-        {
-            RoutingTableEntry rte(destRouter);
-            rte.getNhl().addNextHop(nh);
-            dryTable.push_back(rte);
-        }
-        else
-        {
-            (*it).getNhl().addNextHop(nh);
-        }
-    }
-
-    void
-    RoutingTable::printDryRoutingTable()
-    {
-        cout<<"--------Dry Run's Routing Table--------------"<<endl;
-        for(std::list<RoutingTableEntry>::iterator it=dryTable.begin() ;
-                it != dryTable.end(); ++it)
-        {
-            cout<<(*it)<<endl;
-        }
-    }
-
-
-    void
-    RoutingTable::clearRoutingTable()
-    {
-        if( rTable.size() > 0 )
-        {
-            rTable.clear();
-        }
-    }
-
-    void
-    RoutingTable::clearDryRoutingTable()
-    {
-        if (dryTable.size()>0 )
-        {
-            dryTable.clear();
-        }
-    }
-
-}//namespace nlsr
-
diff --git a/src/nlsr_rt.hpp b/src/nlsr_rt.hpp
deleted file mode 100644
index fb9a060..0000000
--- a/src/nlsr_rt.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef NLSR_RT_HPP
-#define NLSR_RT_HPP
-
-#include<iostream>
-#include<utility>
-#include<string>
-
-#include "nlsr_rte.hpp"
-
-namespace nlsr
-{
-
-    class Nlsr;
-    class NextHop;
-
-    using namespace std;
-
-    class RoutingTable
-    {
-    public:
-        RoutingTable()
-            : NO_NEXT_HOP(-12345)
-        {
-        }
-        void calculate(Nlsr& pnlsr);
-        void addNextHop(string destRouter, NextHop& nh);
-        void printRoutingTable();
-
-        void addNextHopToDryTable(string destRouter, NextHop& nh);
-        void printDryRoutingTable();
-        std::pair<RoutingTableEntry&, bool> findRoutingTableEntry(string destRouter);
-        void scheduleRoutingTableCalculation(Nlsr& pnlsr);
-
-    private:
-        void calculateLsRoutingTable(Nlsr& pnlsr);
-        void calculateHypRoutingTable(Nlsr& pnlsr);
-        void calculateHypDryRoutingTable(Nlsr&pnlsr);
-
-        void clearRoutingTable();
-        void clearDryRoutingTable();
-
-        const int NO_NEXT_HOP;
-
-        std::list< RoutingTableEntry > rTable;
-        std::list< RoutingTableEntry > dryTable;
-    };
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_rtc.cpp b/src/nlsr_rtc.cpp
deleted file mode 100644
index acdf6d5..0000000
--- a/src/nlsr_rtc.cpp
+++ /dev/null
@@ -1,504 +0,0 @@
-#include <iostream>
-#include <cmath>
-#include "nlsr_lsdb.hpp"
-#include "nlsr_rtc.hpp"
-#include "nlsr_map.hpp"
-#include "nlsr_lsa.hpp"
-#include "nlsr_nexthop.hpp"
-#include "nlsr.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    void
-    RoutingTableCalculator::allocateAdjMatrix()
-    {
-        adjMatrix = new double*[numOfRouter];
-        for(int i = 0; i < numOfRouter; ++i)
-        {
-            adjMatrix[i] = new double[numOfRouter];
-        }
-    }
-
-    void
-    RoutingTableCalculator::initMatrix()
-    {
-        for(int i=0; i<numOfRouter; i++)
-        {
-            for(int j=0; j<numOfRouter; j++)
-                adjMatrix[i][j]=0;
-        }
-    }
-
-    void
-    RoutingTableCalculator::makeAdjMatrix(Nlsr& pnlsr, Map pMap)
-    {
-        std::list<AdjLsa> adjLsdb=pnlsr.getLsdb().getAdjLsdb();
-        for( std::list<AdjLsa>::iterator it=adjLsdb.begin();
-                it!= adjLsdb.end() ; it++)
-        {
-            string linkStartRouter=(*it).getOrigRouter();
-            int row=pMap.getMappingNoByRouterName(linkStartRouter);
-            std::list<Adjacent> adl=(*it).getAdl().getAdjList();
-            for( std::list<Adjacent>::iterator itAdl=adl.begin();
-                    itAdl!= adl.end() ; itAdl++)
-            {
-                string linkEndRouter=(*itAdl).getAdjacentName();
-                int col=pMap.getMappingNoByRouterName(linkEndRouter);
-                double cost=(*itAdl).getLinkCost();
-                if ( (row >= 0 && row<numOfRouter) && (col >= 0 && col<numOfRouter) )
-                {
-                    adjMatrix[row][col]=cost;
-                }
-            }
-        }
-    }
-
-    void
-    RoutingTableCalculator::printAdjMatrix()
-    {
-        for(int i=0; i<numOfRouter; i++)
-        {
-            for(int j=0; j<numOfRouter; j++)
-                printf("%f ",adjMatrix[i][j]);
-            printf("\n");
-        }
-    }
-
-    void
-    RoutingTableCalculator::adjustAdMatrix(int source, int link, double linkCost)
-    {
-        for ( int i = 0; i < numOfRouter; i++ )
-        {
-            if ( i == link )
-            {
-                adjMatrix[source][i]=linkCost;
-            }
-            else
-            {
-                adjMatrix[source][i]=0;
-            }
-        }
-    }
-
-    int
-    RoutingTableCalculator::getNumOfLinkfromAdjMatrix(int sRouter)
-    {
-        int noLink=0;
-        for(int i=0; i<numOfRouter; i++)
-        {
-            if ( adjMatrix[sRouter][i] > 0 )
-            {
-                noLink++;
-            }
-        }
-        return noLink;
-    }
-
-    void
-    RoutingTableCalculator::getLinksFromAdjMatrix(int *links,
-            double *linkCosts, int source)
-    {
-        int j=0;
-        for (int i=0; i <numOfRouter; i++)
-        {
-            if ( adjMatrix[source][i] > 0 )
-            {
-                links[j]=i;
-                linkCosts[j]=adjMatrix[source][i];
-                j++;
-            }
-        }
-    }
-
-    void
-    RoutingTableCalculator::freeAdjMatrix()
-    {
-        for(int i = 0; i < numOfRouter; ++i)
-        {
-            delete [] adjMatrix[i];
-        }
-        delete [] adjMatrix;
-    }
-
-
-    void
-    RoutingTableCalculator::allocateLinks()
-    {
-        links=new int[vNoLink];
-    }
-
-    void RoutingTableCalculator::allocateLinkCosts()
-    {
-        linkCosts=new double[vNoLink];
-    }
-
-
-    void
-    RoutingTableCalculator::freeLinks()
-    {
-        delete [] links;
-    }
-    void
-    RoutingTableCalculator::freeLinksCosts()
-    {
-        delete [] linkCosts;
-    }
-
-    void
-    LinkStateRoutingTableCalculator::calculatePath(Map& pMap,
-            RoutingTable& rt, Nlsr& pnlsr)
-    {
-        cout<<"LinkStateRoutingTableCalculator::calculatePath Called"<<endl;
-        allocateAdjMatrix();
-        initMatrix();
-        makeAdjMatrix(pnlsr,pMap);
-        cout<<pMap;
-        printAdjMatrix();
-        string routerName=pnlsr.getConfParameter().getRouterPrefix();
-        int sourceRouter=pMap.getMappingNoByRouterName(routerName);
-        int noLink=getNumOfLinkfromAdjMatrix(sourceRouter);
-        allocateParent();
-        allocateDistance();
-        if ( pnlsr.getConfParameter().getMaxFacesPerPrefix() == 1 )
-        {
-            // Single Path
-            doDijkstraPathCalculation(sourceRouter);
-            // print all ls path -- debugging purpose
-            printAllLsPath(sourceRouter);
-            // update routing table
-            addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
-        }
-        else
-        {
-            // Multi Path
-            setNoLink(getNumOfLinkfromAdjMatrix(sourceRouter));
-            allocateLinks();
-            allocateLinkCosts();
-            getLinksFromAdjMatrix(links, linkCosts, sourceRouter);
-            for (int i=0 ; i < vNoLink; i++)
-            {
-                adjustAdMatrix(sourceRouter,links[i], linkCosts[i]);
-                printAdjMatrix();
-                doDijkstraPathCalculation(sourceRouter);
-                // print all ls path -- debugging purpose
-                printAllLsPath(sourceRouter);
-                //update routing table
-                addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
-            }
-            freeLinks();
-            freeLinksCosts();
-        }
-        freeParent();
-        freeDistance();
-        freeAdjMatrix();
-    }
-
-    void
-    LinkStateRoutingTableCalculator::doDijkstraPathCalculation(int sourceRouter)
-    {
-        int i;
-        int v,u;
-        int *Q=new int[numOfRouter];
-        int head=0;
-        /* Initiate the Parent */
-        for (i = 0 ; i < numOfRouter; i++)
-        {
-            parent[i]=EMPTY_PARENT;
-            distance[i]=INF_DISTANCE;
-            Q[i]=i;
-        }
-        if ( sourceRouter != NO_MAPPING_NUM )
-        {
-            distance[sourceRouter]=0;
-            sortQueueByDistance(Q,distance,head,numOfRouter);
-            while (head < numOfRouter )
-            {
-                u=Q[head];
-                if(distance[u] == INF_DISTANCE)
-                {
-                    break;
-                }
-                for(v=0 ; v <numOfRouter; v++)
-                {
-                    if( adjMatrix[u][v] > 0 )
-                    {
-                        if ( isNotExplored(Q,v,head+1,numOfRouter) )
-                        {
-                            if( distance[u] + adjMatrix[u][v] <  distance[v])
-                            {
-                                distance[v]=distance[u] + adjMatrix[u][v] ;
-                                parent[v]=u;
-                            }
-                        }
-                    }
-                }
-                head++;
-                sortQueueByDistance(Q,distance,head,numOfRouter);
-            }
-        }
-        delete [] Q;
-    }
-
-    void
-    LinkStateRoutingTableCalculator::addAllLsNextHopsToRoutingTable(Nlsr& pnlsr,
-            RoutingTable& rt, Map& pMap, int sourceRouter)
-    {
-        cout<<"LinkStateRoutingTableCalculator::addAllNextHopsToRoutingTable Called";
-        cout<<endl;
-        for(int i=0; i < numOfRouter ; i++)
-        {
-            if ( i!= sourceRouter )
-            {
-                int nextHopRouter=getLsNextHop(i,sourceRouter);
-                double routeCost=distance[i];
-                string nextHopRouterName=pMap.getRouterNameByMappingNo(nextHopRouter);
-                int nxtHopFace=
-                    pnlsr.getAdl().getAdjacent(nextHopRouterName).getConnectingFace();
-                cout<<"Dest Router: "<<pMap.getRouterNameByMappingNo(i)<<endl;
-                cout<<"Next hop Router: "<<nextHopRouterName<<endl;
-                cout<<"Next hop Face: "<<nxtHopFace<<endl;
-                cout<<"Route Cost: "<<routeCost<<endl;
-                cout<<endl;
-                // Add next hop to routing table
-                NextHop nh(nxtHopFace,routeCost);
-                rt.addNextHop(pMap.getRouterNameByMappingNo(i),nh);
-            }
-        }
-    }
-
-    int
-    LinkStateRoutingTableCalculator::getLsNextHop(int dest, int source)
-    {
-        int nextHop;
-        while ( parent[dest] != EMPTY_PARENT )
-        {
-            nextHop=dest;
-            dest=parent[dest];
-        }
-        if ( dest != source )
-        {
-            nextHop=NO_NEXT_HOP;
-        }
-        return nextHop;
-    }
-
-    void
-    LinkStateRoutingTableCalculator::printAllLsPath(int sourceRouter)
-    {
-        cout<<"LinkStateRoutingTableCalculator::printAllLsPath Called"<<endl;
-        cout<<"Source Router: "<<sourceRouter<<endl;
-        for(int i=0; i < numOfRouter ; i++)
-        {
-            if ( i!= sourceRouter )
-            {
-                printLsPath(i);
-                cout<<endl;
-            }
-        }
-    }
-
-    void
-    LinkStateRoutingTableCalculator::printLsPath(int destRouter)
-    {
-        if (parent[destRouter] != EMPTY_PARENT )
-        {
-            printLsPath(parent[destRouter]);
-        }
-        cout<<" "<<destRouter;
-    }
-
-    void
-    LinkStateRoutingTableCalculator::sortQueueByDistance(int *Q,
-            double *dist,int start,int element)
-    {
-        for ( int i=start ; i < element ; i ++)
-        {
-            for( int j=i+1; j<element; j ++)
-            {
-                if (dist[Q[j]] < dist[Q[i]])
-                {
-                    int tempU=Q[j];
-                    Q[j]=Q[i];
-                    Q[i]=tempU;
-                }
-            }
-        }
-    }
-
-    int
-    LinkStateRoutingTableCalculator::isNotExplored(int *Q,
-            int u,int start, int element)
-    {
-        int ret=0;
-        for(int i=start; i< element; i++)
-        {
-            if ( Q[i] == u )
-            {
-                ret=1;
-                break;
-            }
-        }
-        return ret;
-    }
-
-    void
-    LinkStateRoutingTableCalculator::allocateParent()
-    {
-        parent=new int[numOfRouter];
-    }
-
-    void
-    LinkStateRoutingTableCalculator::allocateDistance()
-    {
-        distance= new double[numOfRouter];
-    }
-
-    void
-    LinkStateRoutingTableCalculator::freeParent()
-    {
-        delete [] parent;
-    }
-
-    void LinkStateRoutingTableCalculator::freeDistance()
-    {
-        delete [] distance;
-    }
-
-
-
-    void
-    HypRoutingTableCalculator::calculatePath(Map& pMap,
-            RoutingTable& rt, Nlsr& pnlsr)
-    {
-        makeAdjMatrix(pnlsr,pMap);
-        string routerName=pnlsr.getConfParameter().getRouterPrefix();
-        int sourceRouter=pMap.getMappingNoByRouterName(routerName);
-        int noLink=getNumOfLinkfromAdjMatrix(sourceRouter);
-        setNoLink(noLink);
-        allocateLinks();
-        allocateLinkCosts();
-        getLinksFromAdjMatrix(links, linkCosts, sourceRouter);
-        for(int i=0 ; i < numOfRouter ; ++i)
-        {
-            int k=0;
-            if ( i != sourceRouter)
-            {
-                allocateLinkFaces();
-                allocateDistanceToNeighbor();
-                allocateDistFromNbrToDest();
-                for(int j=0; j<vNoLink; j++)
-                {
-                    string nextHopRouterName=pMap.getRouterNameByMappingNo(links[j]);
-                    int nextHopFace=
-                        pnlsr.getAdl().getAdjacent(nextHopRouterName).getConnectingFace();
-                    double distToNbr=getHyperbolicDistance(pnlsr,pMap,
-                                                           sourceRouter,links[j]);
-                    double distToDestFromNbr=getHyperbolicDistance(pnlsr,
-                                             pMap,links[j],i);
-                    if ( distToDestFromNbr >= 0 )
-                    {
-                        linkFaces[k] = nextHopFace;
-                        distanceToNeighbor[k] = distToNbr;
-                        distFromNbrToDest[k] = distToDestFromNbr;
-                        k++;
-                    }
-                }
-                addHypNextHopsToRoutingTable(pnlsr,pMap,rt,k,i);
-                freeLinkFaces();
-                freeDistanceToNeighbor();
-                freeDistFromNbrToDest();
-            }
-        }
-        freeLinks();
-        freeLinksCosts();
-        freeAdjMatrix();
-    }
-
-    void
-    HypRoutingTableCalculator::addHypNextHopsToRoutingTable(Nlsr& pnlsr,Map& pMap,
-            RoutingTable& rt, int noFaces, int dest)
-    {
-        for(int i=0 ; i < noFaces ; ++i)
-        {
-            string destRouter=pMap.getRouterNameByMappingNo(dest);
-            NextHop nh(linkFaces[i],distFromNbrToDest[i]);
-            rt.addNextHop(destRouter,nh);
-            if( isDryRun == 1 )
-            {
-                rt.addNextHopToDryTable(destRouter,nh);
-            }
-        }
-    }
-
-    double
-    HypRoutingTableCalculator::getHyperbolicDistance(Nlsr& pnlsr,
-            Map& pMap, int src, int dest)
-    {
-        double distance=0.0;
-        string srcRouterKey=pMap.getRouterNameByMappingNo(src)+"/3";
-        string destRouterKey=pMap.getRouterNameByMappingNo(dest)+"/3";
-        double srcRadius=(pnlsr.getLsdb().getCorLsa(srcRouterKey).first).getCorRadius();
-        double srcTheta=(pnlsr.getLsdb().getCorLsa(srcRouterKey).first).getCorTheta();
-        double destRadius=(pnlsr.getLsdb().getCorLsa(
-                               destRouterKey).first).getCorRadius();
-        double destTheta=(pnlsr.getLsdb().getCorLsa(destRouterKey).first).getCorTheta();
-        double diffTheta = fabs (srcTheta - destTheta);
-        if (diffTheta > MATH_PI)
-        {
-            diffTheta = 2 * MATH_PI - diffTheta;
-        }
-        if ( srcRadius != -1 && destRadius != -1 )
-        {
-            if (diffTheta == 0)
-                distance = fabs (srcRadius - destRadius);
-            else
-                distance = acosh((cosh(srcRadius)*cosh(destRadius))-
-                                 (sinh(srcRadius)*sinh(destRadius)*cos(diffTheta)));
-        }
-        else
-        {
-            distance = -1;
-        }
-        return distance;
-    }
-
-    void
-    HypRoutingTableCalculator::allocateLinkFaces()
-    {
-        linkFaces=new int[vNoLink];
-    }
-
-    void
-    HypRoutingTableCalculator::allocateDistanceToNeighbor()
-    {
-        distanceToNeighbor=new double[vNoLink];
-    }
-
-    void
-    HypRoutingTableCalculator::allocateDistFromNbrToDest()
-    {
-        distFromNbrToDest=new double[vNoLink];
-    }
-
-    void
-    HypRoutingTableCalculator::freeLinkFaces()
-    {
-        delete [] linkFaces;
-    }
-
-    void
-    HypRoutingTableCalculator::freeDistanceToNeighbor()
-    {
-        delete [] distanceToNeighbor;
-    }
-
-    void
-    HypRoutingTableCalculator::freeDistFromNbrToDest()
-    {
-        delete [] distFromNbrToDest;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_rtc.hpp b/src/nlsr_rtc.hpp
deleted file mode 100644
index 987686e..0000000
--- a/src/nlsr_rtc.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifndef NLSR_RTC_HPP
-#define NLSR_RTC_HPP
-
-#include <list>
-#include <iostream>
-
-namespace nlsr
-{
-
-    class Map;
-    class RoutingTable;
-    class Nlsr;
-
-
-    using namespace std;
-
-    class RoutingTableCalculator
-    {
-    public:
-        RoutingTableCalculator()
-        {
-        }
-        RoutingTableCalculator(int rn)
-        {
-            numOfRouter=rn;
-        }
-    protected:
-        void allocateAdjMatrix();
-        void initMatrix();
-        void makeAdjMatrix(Nlsr& pnlsr,Map pMap);
-        void printAdjMatrix();
-        int getNumOfLinkfromAdjMatrix(int sRouter);
-        void freeAdjMatrix();
-        void adjustAdMatrix(int source, int link, double linkCost);
-        void getLinksFromAdjMatrix(int *links, double *linkCosts, int source);
-
-        void allocateLinks();
-        void allocateLinkCosts();
-        void freeLinks();
-        void freeLinksCosts();
-
-        void setNoLink(int nl)
-        {
-            vNoLink=nl;
-        }
-
-    protected:
-        double ** adjMatrix;
-        int numOfRouter;
-
-        int vNoLink;
-        int *links;
-        double *linkCosts;
-    };
-
-    class LinkStateRoutingTableCalculator: public RoutingTableCalculator
-    {
-    public:
-        LinkStateRoutingTableCalculator(int rn)
-            : EMPTY_PARENT(-12345)
-            , INF_DISTANCE(2147483647)
-            , NO_MAPPING_NUM(-1)
-            , NO_NEXT_HOP(-12345)
-        {
-            numOfRouter=rn;
-        }
-
-
-        void calculatePath(Map& pMap, RoutingTable& rt, Nlsr& pnlsr);
-
-
-    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 printAllLsPath(int sourceRouter);
-        void printLsPath(int destRouter);
-        void addAllLsNextHopsToRoutingTable(Nlsr& pnlsr, RoutingTable& rt,
-                                            Map& pMap,int sourceRouter);
-        int getLsNextHop(int dest, int source);
-
-        void allocateParent();
-        void allocateDistance();
-        void freeParent();
-        void freeDistance();
-
-
-
-
-    private:
-        int *parent;
-        double *distance;
-
-
-        const int EMPTY_PARENT;
-        const double INF_DISTANCE;
-        const int NO_MAPPING_NUM;
-        const int NO_NEXT_HOP;
-
-    };
-
-    class HypRoutingTableCalculator: public RoutingTableCalculator
-    {
-    public:
-        HypRoutingTableCalculator(int rn)
-            :  MATH_PI(3.141592654)
-        {
-            numOfRouter=rn;
-            isDryRun=0;
-        }
-        HypRoutingTableCalculator(int rn, int idr)
-            :  MATH_PI(3.141592654)
-        {
-            numOfRouter=rn;
-            isDryRun=idr;
-        }
-
-        void calculatePath(Map& pMap, RoutingTable& rt, Nlsr& pnlsr);
-
-    private:
-        void allocateLinkFaces();
-        void allocateDistanceToNeighbor();
-        void allocateDistFromNbrToDest();
-        void freeLinkFaces();
-        void freeDistanceToNeighbor();
-        void freeDistFromNbrToDest();
-
-        double getHyperbolicDistance(Nlsr& pnlsr,Map& pMap, int src, int dest);
-        void addHypNextHopsToRoutingTable(Nlsr& pnlsr,Map& pMap,
-                                          RoutingTable& rt, int noFaces,int dest);
-
-    private:
-        int isDryRun;
-
-        int *linkFaces;
-        double *distanceToNeighbor;
-        double *distFromNbrToDest;
-
-        const double MATH_PI;
-
-    };
-
-}//namespace nlsr
-
-#endif
diff --git a/src/nlsr_rte.cpp b/src/nlsr_rte.cpp
deleted file mode 100644
index f96da11..0000000
--- a/src/nlsr_rte.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <iostream>
-#include <string>
-
-#include "nlsr_rte.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    ostream&
-    operator<<(ostream& os, RoutingTableEntry &rte)
-    {
-        os<<"Destination: "<<rte.getDestination()<<endl;
-        os<<"Nexthops: "<<endl;
-        int i=1;
-        std::list< NextHop > nhl = rte.getNhl().getNextHopList();
-        for( std::list<NextHop>::iterator it=nhl.begin();
-                it!= nhl.end() ; it++,i++)
-        {
-            os <<"  Nexthop "<<i<<": "<<(*it)<<endl;
-        }
-        return os;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_rte.hpp b/src/nlsr_rte.hpp
deleted file mode 100644
index 27d3601..0000000
--- a/src/nlsr_rte.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef NLSR_RTE_HPP
-#define NLSR_RTE_HPP
-
-#include<iostream>
-
-#include "nlsr_nhl.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class RoutingTableEntry
-    {
-    public:
-        RoutingTableEntry()
-            : destination()
-            , nhl()
-        {
-        }
-
-        ~RoutingTableEntry()
-        {
-        }
-
-        RoutingTableEntry(string dest)
-            : nhl()
-        {
-            destination=dest;
-        }
-
-        string getDestination()
-        {
-            return destination;
-        }
-
-        Nhl& getNhl()
-        {
-            return nhl;
-        }
-
-    private:
-        string destination;
-        Nhl nhl;
-    };
-
-    ostream&
-    operator<<(ostream& os, RoutingTableEntry &rte);
-
-}
-
-#endif
diff --git a/src/nlsr_sm.cpp b/src/nlsr_sm.cpp
index d9f3a95..cae7f60 100644
--- a/src/nlsr_sm.cpp
+++ b/src/nlsr_sm.cpp
@@ -1,5 +1,10 @@
 #include <string>
 #include <iostream>
+#include <fstream>
+#include <pwd.h>
+#include <cstdlib>
+#include <unistd.h>
+
 #include "nlsr_sm.hpp"
 
 namespace nlsr
@@ -7,7 +12,85 @@
 
     using namespace std;
 
-    class Nlsr;
+    void
+    SequencingManager::splittSequenceNo(uint64_t seqNo)
+    {
+        combinedSeqNo=seqNo;
+        adjLsaSeq = (combinedSeqNo & 0xFFFFF);
+        corLsaSeq = ((combinedSeqNo >> 20) & 0xFFFFF);
+        nameLsaSeq = ((combinedSeqNo >> 40) & 0xFFFFF);
+    }
+
+    void
+    SequencingManager::combineSequenceNo()
+    {
+        combinedSeqNo=0;
+        combinedSeqNo = combinedSeqNo | adjLsaSeq;
+        combinedSeqNo = combinedSeqNo | (corLsaSeq<<20);
+        combinedSeqNo = combinedSeqNo | (nameLsaSeq<<40);
+    }
+
+    void
+    SequencingManager::writeSeqNoToFile()
+    {
+        std::ofstream outputFile(seqFileNameWithPath.c_str(),ios::binary);
+        outputFile<<combinedSeqNo;
+        outputFile.close();
+    }
+
+    void
+    SequencingManager::initiateSeqNoFromFile()
+    {
+        cout<<"Seq File Name: "<< seqFileNameWithPath<<endl;
+        std::ifstream inputFile(seqFileNameWithPath.c_str(),ios::binary);
+        if ( inputFile.good() )
+        {
+            inputFile>>combinedSeqNo;
+            splittSequenceNo(combinedSeqNo);
+            adjLsaSeq+=10;
+            corLsaSeq+=10;
+            nameLsaSeq+=10;
+            combineSequenceNo();
+            inputFile.close();
+        }
+        else
+        {
+            splittSequenceNo(0);
+        }
+    }
+
+    void
+    SequencingManager::setSeqFileName(string filePath)
+    {
+        seqFileNameWithPath=filePath;
+        if( seqFileNameWithPath.empty() )
+        {
+            seqFileNameWithPath=getUserHomeDirectory();
+        }
+        seqFileNameWithPath=seqFileNameWithPath+"/nlsrSeqNo.txt";
+    }
+
+    string
+    SequencingManager::getUserHomeDirectory()
+    {
+        string homeDirPath(getpwuid(getuid())->pw_dir);
+        if( homeDirPath.empty() )
+        {
+            homeDirPath = getenv("HOME");
+        }
+        return homeDirPath;
+    }
+
+    ostream&
+    operator <<(ostream& os, const SequencingManager& sm)
+    {
+        std::cout<<"----SequencingManager----"<<std::endl;
+        std::cout<<"Adj LSA seq no: "<<sm.getAdjLsaSeq()<<endl;
+        std::cout<<"Cor LSA Seq no: "<<sm.getCorLsaSeq()<<endl;
+        std::cout<<"Name LSA Seq no: "<<sm.getNameLsaSeq()<<endl;
+        std::cout<<"Combined LSDB Seq no: "<<sm.getCombinedSeqNo()<<endl;
+        return os;
+    }
 
 }//namespace nlsr
 
diff --git a/src/nlsr_sm.hpp b/src/nlsr_sm.hpp
index 7dfe1b0..b1b1b39 100644
--- a/src/nlsr_sm.hpp
+++ b/src/nlsr_sm.hpp
@@ -17,52 +17,81 @@
             : nameLsaSeq(0)
             , adjLsaSeq(0)
             , corLsaSeq(0)
+            , combinedSeqNo(0)
+            , seqFileNameWithPath()
         {
         }
 
-        SequencingManager(uint32_t nlsn, uint32_t alsn, uint32_t clsn)
+        SequencingManager(uint64_t seqNo)
+        {
+            splittSequenceNo(seqNo);
+        }
+
+        SequencingManager(uint64_t nlsn, uint64_t alsn, uint64_t clsn)
         {
             nameLsaSeq=nlsn;
             adjLsaSeq=alsn;
             corLsaSeq=clsn;
+            combineSequenceNo();
         }
 
-        uint32_t getNameLsaSeq()
+        uint64_t getNameLsaSeq() const
         {
             return nameLsaSeq;
         }
 
-        void setNameLsaSeq(uint32_t nlsn)
+        void setNameLsaSeq(uint64_t nlsn)
         {
             nameLsaSeq=nlsn;
+            combineSequenceNo();
         }
 
-        uint32_t getAdjLsaSeq()
+        uint64_t getAdjLsaSeq() const
         {
             return adjLsaSeq;
         }
 
-        void setAdjLsaSeq(uint32_t alsn)
+        void setAdjLsaSeq(uint64_t alsn)
         {
             adjLsaSeq=alsn;
+            combineSequenceNo();
         }
 
-        uint32_t getCorLsaSeq()
+        uint64_t getCorLsaSeq() const
         {
             return corLsaSeq;
         }
 
-        void setCorLsaSeq(uint32_t clsn)
+        void setCorLsaSeq(uint64_t clsn)
         {
             corLsaSeq=clsn;
+            combineSequenceNo();
         }
 
+        uint64_t getCombinedSeqNo() const
+        {
+            return combinedSeqNo;
+        }
+
+        void writeSeqNoToFile();
+        void initiateSeqNoFromFile();
+        void setSeqFileName(string filePath);
+        string getUserHomeDirectory();
+
     private:
-        uint32_t nameLsaSeq;
-        uint32_t adjLsaSeq;
-        uint32_t corLsaSeq;
+        void splittSequenceNo(uint64_t seqNo);
+        void combineSequenceNo();
+
+
+    private:
+        uint64_t nameLsaSeq;
+        uint64_t adjLsaSeq;
+        uint64_t corLsaSeq;
+        uint64_t combinedSeqNo;
+        string seqFileNameWithPath;
     };
 
 
+    ostream& operator <<(ostream& os, const SequencingManager& sm);
 }//namespace nlsr
 #endif
diff --git a/src/nlsr_test.cpp b/src/nlsr_test.cpp
deleted file mode 100644
index c04fd77..0000000
--- a/src/nlsr_test.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-#include <ndn-cpp-dev/face.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/scheduler.hpp>
-
-#include "nlsr.hpp"
-#include "nlsr_test.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace ndn;
-
-    void
-    NlsrTest::schedlueAddingLsas(Nlsr& pnlsr)
-    {
-        // scheduling adding two name lsas, two Cor Lsas and three Adj LSAs
-        //Scheduling Adding LSAs for router altair
-        string router("/ndn/memphis.edu/cs/altair");
-        string name1("/ndn/memphis.edu/cs/altair/name1");
-        string name2("/ndn/memphis.edu/cs/altair/name2");
-        string name3("/ndn/memphis.edu/cs/broadcast");
-        Adjacent adj1("/ndn/memphis.edu/cs/pollux",7,17,1,0);
-        Adjacent adj2("/ndn/memphis.edu/cs/maia",15,27,1,0);
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(30),
-                                           ndn::bind(&NlsrTest::secheduledAddNameLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,router,name1,name2,name3));
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(37),
-                                           ndn::bind(&NlsrTest::secheduledAddCorLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,router,123.098,1.875));
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(47),
-                                           ndn::bind(&NlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,router,adj1,adj2));
-        //Scheduling Adding LSAs for router Maia
-        string routerMaia("/ndn/memphis.edu/cs/maia");
-        string maiaName1("/ndn/memphis.edu/maia/name1");
-        string maiaName2("/ndn/memphis.edu/maia/name2");
-        string maiaName3("/ndn/memphis.edu/cs/broadcast");
-        Adjacent maiaAdj1("/ndn/memphis.edu/cs/pollux",8,25,1,0);
-        Adjacent maiaAdj2("/ndn/memphis.edu/cs/altair",11,15,1,0);
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(55),
-                                           ndn::bind(&NlsrTest::secheduledAddNameLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,routerMaia,maiaName1,maiaName2,maiaName3));
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(65),
-                                           ndn::bind(&NlsrTest::secheduledAddCorLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,routerMaia,12.098,0.875));
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(75),
-                                           ndn::bind(&NlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,routerMaia,maiaAdj1,maiaAdj2));
-        //sheduling Adding LSAs for Router itself
-        string routerPollux("/ndn/memphis.edu/cs/pollux");
-        Adjacent polluxAdj1("/ndn/memphis.edu/cs/maia",9,13,1,0);
-        Adjacent polluxAdj2("/ndn/memphis.edu/cs/altair",12,23,1,0);
-        pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(90),
-                                           ndn::bind(&NlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
-                                                   boost::ref(pnlsr)
-                                                   ,routerPollux,polluxAdj1,polluxAdj2));
-    }
-
-
-
-    void
-    NlsrTest::secheduledAddNameLsa(Nlsr& pnlsr, string router,
-                                   string name1, string name2, string name3)
-    {
-        Npl npl;
-        npl.insertIntoNpl(name1);
-        npl.insertIntoNpl(name2);
-        npl.insertIntoNpl(name3);
-        NameLsa nameLsa(router,1,1,3600,npl);
-        pnlsr.getLsdb().installNameLsa(pnlsr, nameLsa);
-    }
-
-    void
-    NlsrTest::secheduledAddCorLsa(Nlsr& pnlsr,string router, double r, double angle)
-    {
-        CorLsa corLsa(router,3,1,3600,r,angle);
-        pnlsr.getLsdb().installCorLsa(pnlsr, corLsa);
-    }
-
-    void
-    NlsrTest::scheduledAddAdjacentLsa(Nlsr& pnlsr, string router,
-                                      Adjacent adj1, Adjacent adj2)
-    {
-        Adl adl;
-        adl.insert(adj1);
-        adl.insert(adj2);
-        AdjLsa adjLsa(router,2,1,3600,2,adl);
-        pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
-    }
-
-}//namespace nlsr
-
diff --git a/src/nlsr_test.hpp b/src/nlsr_test.hpp
deleted file mode 100644
index 9963b3b..0000000
--- a/src/nlsr_test.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef NLSR_TEST_HPP
-#define NLSR_TEST_HPP
-
-#include <iostream>
-#include <string>
-
-#include "nlsr_lsdb.hpp"
-#include "nlsr_lsa.hpp"
-#include "nlsr_adl.hpp"
-#include "nlsr_npl.hpp"
-#include "nlsr_adjacent.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-
-    class Nlsr;
-
-    class NlsrTest
-    {
-    public:
-        NlsrTest()
-        {
-        }
-        void schedlueAddingLsas(Nlsr& pnlsr);
-    private:
-        void secheduledAddNameLsa(Nlsr& pnlsr, string router,
-                                  string name1, string name2, string name3);
-        void secheduledAddCorLsa(Nlsr& pnlsr,string router, double r, double angle);
-
-        void scheduledAddAdjacentLsa(Nlsr& pnlsr, string router,
-                                     Adjacent adj1, Adjacent adj2);
-
-    };
-
-} //namespace nlsr
-#endif
diff --git a/src/nlsr_tokenizer.cpp b/src/nlsr_tokenizer.cpp
deleted file mode 100644
index d64a600..0000000
--- a/src/nlsr_tokenizer.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <algorithm>
-
-#include "nlsr_tokenizer.hpp"
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace boost;
-
-    void
-    nlsrTokenizer::makeToken()
-    {
-        char_separator<char> sep(seps.c_str());
-        tokenizer< char_separator<char> >tokens(originalString, sep);
-        tokenizer< char_separator<char> >::iterator tok_iter = tokens.begin();
-        string ft(*tok_iter);
-        firstToken=ft;
-        ++tok_iter;
-        for ( ; tok_iter != tokens.end(); ++tok_iter)
-        {
-            string oneToken(*tok_iter);
-            this->insertToken(oneToken);
-            restOfTheLine+=oneToken;
-            restOfTheLine+=seps;
-        }
-        trim(restOfTheLine);
-    }
-
-    void
-    nlsrTokenizer::insertToken(const string& token)
-    {
-        tokenList.push_back(token);
-    }
-
-    int
-    nlsrTokenizer::getTokenPosition(string& token)
-    {
-        int pos=-1;
-        int i=1;
-        for(std::list<string>::iterator it=tokenList.begin(); it!=tokenList.end(); it++)
-        {
-            if( (*it) == token )
-            {
-                break;
-            }
-            i++;
-        }
-        if( i < tokenList.size() )
-        {
-            pos=i;
-        }
-        return pos;
-    }
-
-    string
-    nlsrTokenizer::getTokenString(int from , int to)
-    {
-        string returnString;
-        if ( from >=0 && to < tokenList.size())
-        {
-            int i=0;
-            for(std::list<string>::iterator it=tokenList.begin();
-                    it!=tokenList.end(); it++)
-            {
-                i++;
-                if( i >= from && i<= to )
-                {
-                    string oneToken((*it));
-                    returnString+=seps;
-                    returnString+=oneToken;
-                }
-            }
-        }
-        trim(returnString);
-        return returnString;
-    }
-
-    string
-    nlsrTokenizer::getTokenString(int from)
-    {
-        string returnString;
-        if ( from >=0 && from < tokenList.size())
-        {
-            int i=0;
-            for(std::list<string>::iterator it=tokenList.begin();
-                    it!=tokenList.end(); it++)
-            {
-                i++;
-                if( i >= from)
-                {
-                    string oneToken((*it));
-                    returnString+=seps;
-                    returnString+=oneToken;
-                }
-            }
-        }
-        trim(returnString);
-        return returnString;
-    }
-
-    static bool
-    tokenCompare(string& s1, string& s2)
-    {
-        return s1==s2;
-    }
-
-    bool
-    nlsrTokenizer::doesTokenExist(string token)
-    {
-        std::list<string >::iterator it = std::find_if( tokenList.begin(),
-                                          tokenList.end(),
-                                          bind(&tokenCompare, _1 , token));
-        if( it != tokenList.end() )
-        {
-            return true;
-        }
-        return false;
-    }
-
-}//namespace nlsr
diff --git a/src/nlsr_tokenizer.hpp b/src/nlsr_tokenizer.hpp
deleted file mode 100644
index 4818952..0000000
--- a/src/nlsr_tokenizer.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef NLSR_TOKENIZER_HPP
-#define NLSR_TOKENIZER_HPP
-
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <list>
-#include <ndn-cpp-dev/face.hpp>
-
-namespace nlsr
-{
-
-    using namespace std;
-    using namespace boost;
-
-    class nlsrTokenizer
-    {
-    public:
-        nlsrTokenizer(const string& inputString)
-            :firstToken(),
-             restOfTheLine()
-        {
-            seps = " ";
-            originalString = inputString;
-            makeToken();
-        }
-
-        nlsrTokenizer(const string& inputString, const string& separator)
-            :firstToken(),
-             restOfTheLine()
-        {
-            seps = separator;
-            originalString = inputString;
-            makeToken();
-        }
-
-        string getFirstToken()
-        {
-            return firstToken;
-        }
-
-        string getRestOfLine()
-        {
-            return restOfTheLine;
-        }
-
-        int getTokenPosition(string& token);
-        string getTokenString(int from , int to);
-        string getTokenString(int from);
-        bool doesTokenExist(string token);
-
-    private:
-
-        void makeToken();
-        void insertToken(const string& token);
-
-        string seps;
-        string originalString;
-        string firstToken;
-        string restOfTheLine;
-        std::list<string> tokenList;
-    };
-
-}//namespace nlsr
-#endif
diff --git a/wscript b/wscript
index 5fc6407..cdceeaa 100644
--- a/wscript
+++ b/wscript
@@ -4,13 +4,15 @@
 
 def options(opt):
     opt.load('compiler_c compiler_cxx gnu_dirs c_osx')
-    opt.load('boost', tooldir=['waf-tools'])
+    opt.load('boost cryptopp', tooldir=['waf-tools'])
 
     opt = opt.add_option_group('Options')
     opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
+    opt.add_option('--without-osx-keychain', action='store_false', default=True, dest='with_osx_keychain',
+                   help='''On Darwin, do not use OSX keychain as a default TPM''')
 
 def configure(conf):
-    conf.load("compiler_cxx boost gnu_dirs")
+    conf.load("compiler_c compiler_cxx boost gnu_dirs c_osx cryptopp")
 
     if conf.options.debug:
         conf.define ('_DEBUG', 1)
@@ -33,17 +35,33 @@
         flags = ['-O3', '-g', '-Wno-tautological-compare','-Wno-unused-variable',
                          '-Wno-unused-function', '-Wno-deprecated-declarations']
         conf.add_supported_cxxflags (cxxflags = flags)
+    if Utils.unversioned_sys_platform () == "darwin":
+        conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', mandatory=True)
+        conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', mandatory=True)
+        conf.check_cxx(framework_name='Security',   uselib_store='OSX_SECURITY',   define_name='HAVE_SECURITY',
+                       use="OSX_COREFOUNDATION", mandatory=True)
+        conf.define('HAVE_OSX_SECURITY', 1)
 
     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)
+    
+    if Utils.unversioned_sys_platform () == "darwin":
+        conf.env['WITH_OSX_KEYCHAIN'] = conf.options.with_osx_keychain
+        if conf.options.with_osx_keychain:
+            conf.define('WITH_OSX_KEYCHAIN', 1)
+    else:
+        conf.env['WITH_OSX_KEYCHAIN'] = False
 
 def build (bld):
     bld (
         features=['cxx', 'cxxprogram'],
         target="nlsr",
-        source = bld.path.ant_glob('src/*.cpp'),
-        use = 'NDN_CPP BOOST nsync',
+        source = bld.path.ant_glob('src/**/*.cpp'),
+        use = 'NDN_CPP BOOST CRYPTOPP SQLITE3 nsync',
+        includes = ". src"
         )
 
 @Configure.conf