diff --git a/nlsr_lsa.cpp b/nlsr_lsa.cpp
index 5495859..38d3fd5 100644
--- a/nlsr_lsa.cpp
+++ b/nlsr_lsa.cpp
@@ -8,11 +8,12 @@
 
 using namespace std;
 
-string 
-Lsa::getLsaKey()
+
+string
+NameLsa::getNameLsaKey()
 {
 	string key;
-	key=origRouter + "/" + boost::lexical_cast<std::string>(lsType);
+	key=origRouter + "/" + boost::lexical_cast<std::string>(1);
 	return key;
 }
 
@@ -72,6 +73,7 @@
 }
 
 
+
 CorLsa::CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
 	      																							, double r, double theta)
 {
@@ -83,6 +85,14 @@
 	corTheta=theta;
 }
 
+string
+CorLsa::getCorLsaKey()
+{
+	string key;
+	key=origRouter + "/" + boost::lexical_cast<std::string>(3);
+	return key;
+}
+
 string 
 CorLsa::getCorLsaData()
 {
@@ -131,6 +141,14 @@
 	}
 }
 
+string
+AdjLsa::getAdjLsaKey()
+{
+	string key;
+	key=origRouter + "/" + boost::lexical_cast<std::string>(2);
+	return key;
+}
+
 string 
 AdjLsa::getAdjLsaData(){
 	string adjLsaData;
diff --git a/nlsr_lsa.hpp b/nlsr_lsa.hpp
index 225229f..a8d3861 100644
--- a/nlsr_lsa.hpp
+++ b/nlsr_lsa.hpp
@@ -56,7 +56,7 @@
 	{
 		lifeTime=lt;
 	}
-	string getLsaKey();
+	//string getLsaKey();
 protected:
 	string origRouter;
 	uint8_t lsType;
@@ -84,6 +84,8 @@
 		npl.insertIntoNpl(name);
 	}
 
+	string getNameLsaKey();
+
 	string getNameLsaData();
 	
 private:
@@ -113,7 +115,7 @@
 	{
 		adl.insert(adj);
 	}
-
+	string getAdjLsaKey();
 	string getAdjLsaData();
 	uint32_t getNoLink()
 	{
@@ -138,6 +140,7 @@
 
 	CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
 	      																							, double r, double theta);
+	string getCorLsaKey();
 	string getCorLsaData();
 	
 	double getCorRadius()
diff --git a/nlsr_lsdb.cpp b/nlsr_lsdb.cpp
index ffd49b1..8d7e141 100644
--- a/nlsr_lsdb.cpp
+++ b/nlsr_lsdb.cpp
@@ -33,7 +33,7 @@
 
 static bool
 nameLsaCompareByKey(NameLsa& nlsa1, string& key){
-	return nlsa1.getLsaKey()==key;
+	return nlsa1.getNameLsaKey()==key;
 }
 
 
@@ -69,7 +69,7 @@
 bool 
 Lsdb::installNameLsa(NameLsa &nlsa)
 {
-	bool doesLsaExist_ = doesNameLsaExist(nlsa.getLsaKey());
+	bool doesLsaExist_ = doesNameLsaExist(nlsa.getNameLsaKey());
 	if ( !doesLsaExist_ )
 	{
 		// add name LSA
@@ -81,7 +81,7 @@
 	else
 	{
 		// check for newer name LSA
-		NameLsa oldNameLsa=getNameLsa(nlsa.getLsaKey());
+		NameLsa oldNameLsa=getNameLsa(nlsa.getNameLsaKey());
 		// Discard or Update Name lsa, NPT, FIB
 		// if its not own LSA
 	}
@@ -94,7 +94,7 @@
 {
 	std::list<NameLsa >::iterator it = std::find_if( nameLsdb.begin(), 
 																		nameLsdb.end(),	
-   													  bind(nameLsaCompareByKey, _1, nlsa.getLsaKey()));
+   													  bind(nameLsaCompareByKey, _1, nlsa.getNameLsaKey()));
 
 	if( it == nameLsdb.end())
 	{
@@ -152,7 +152,7 @@
 */
 static bool
 corLsaCompareByKey(CorLsa& clsa, string& key){
-	return clsa.getLsaKey()==key;
+	return clsa.getCorLsaKey()==key;
 }
 
 bool 
@@ -184,7 +184,7 @@
 bool 
 Lsdb::installCorLsa(CorLsa &clsa)
 {
-	bool doesLsaExist_ = doesCorLsaExist(clsa.getLsaKey());
+	bool doesLsaExist_ = doesCorLsaExist(clsa.getCorLsaKey());
 	if ( !doesLsaExist_ )
 	{
 		// add cor LSA
@@ -196,7 +196,7 @@
 	else
 	{
 		// check for newer cor LSA
-		CorLsa oldCorLsa=getCorLsa(clsa.getLsaKey());
+		CorLsa oldCorLsa=getCorLsa(clsa.getCorLsaKey());
 		
 	}
 	
@@ -208,7 +208,7 @@
 {
 	std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(), 
 																		corLsdb.end(),	
-   														bind(corLsaCompareByKey, _1, clsa.getLsaKey()));
+   														bind(corLsaCompareByKey, _1, clsa.getCorLsaKey()));
 
 	if( it == corLsdb.end())
 	{
@@ -268,7 +268,7 @@
 */
 static bool
 adjLsaCompareByKey(AdjLsa& alsa, string& key){
-	return alsa.getLsaKey()==key;
+	return alsa.getAdjLsaKey()==key;
 }
 
 
@@ -315,7 +315,7 @@
 {
 	std::list<AdjLsa >::iterator it = std::find_if( adjLsdb.begin(), 
 																		adjLsdb.end(),	
-   														bind(adjLsaCompareByKey, _1, alsa.getLsaKey()));
+   														bind(adjLsaCompareByKey, _1, alsa.getAdjLsaKey()));
 
 	if( it == adjLsdb.end()){
 		adjLsdb.push_back(alsa);
@@ -340,7 +340,7 @@
 bool 
 Lsdb::installAdjLsa(nlsr& pnlsr, AdjLsa &alsa)
 {
-	bool doesLsaExist_ = doesAdjLsaExist(alsa.getLsaKey());
+	bool doesLsaExist_ = doesAdjLsaExist(alsa.getAdjLsaKey());
 	if ( !doesLsaExist_ )
 	{
 		// add Adj LSA
@@ -357,7 +357,7 @@
 	else
 	{
 		// check for newer name LSA
-		AdjLsa oldAdjLsa=getAdjLsa(alsa.getLsaKey());
+		AdjLsa oldAdjLsa=getAdjLsa(alsa.getAdjLsaKey());
 		
 	}
 
diff --git a/nlsr_rt.cpp b/nlsr_rt.cpp
index b2cc8b9..95b138d 100644
--- a/nlsr_rt.cpp
+++ b/nlsr_rt.cpp
@@ -22,6 +22,7 @@
 		{
 			if(pnlsr.getIsBuildAdjLsaSheduled() != 1)
 			{
+				cout<<"CLearing old routing table ....."<<endl;
 				clearRoutingTable();
 				clearDryRoutingTable(); // for dry run options
 				// calculate Link State routing
@@ -52,7 +53,7 @@
 		else
 		{
 			cout<<"No Adj LSA of router itself,";
-			cout<<	" so Routint table can not be calculated :("<<endl;	
+			cout<<	" so Routing table can not be calculated :("<<endl;	
 			clearRoutingTable();
 		  clearDryRoutingTable(); // for dry run options
 		  // need to update NPT here
@@ -73,15 +74,13 @@
 void 
 RoutingTable::calculateLsRoutingTable(nlsr& pnlsr)
 {
+	cout<<"RoutingTable::calculateLsRoutingTable Called"<<endl;
 	Map vMap;
 	vMap.createMapFromAdjLsdb(pnlsr);
 	int numOfRouter=vMap.getMapSize();
 
 	LinkStateRoutingTableCalculator lsrtc(numOfRouter);
-	lsrtc.allocateAdjMatrix();
-	lsrtc.makeAdjMatrix(pnlsr,vMap);
 	lsrtc.calculatePath(vMap,boost::ref(*this),pnlsr);
-	lsrtc.freeAdjMatrix();
 	
 	
 }
@@ -101,12 +100,18 @@
 void 
 RoutingTable::clearRoutingTable()
 {
-	rTable.clear();
+	if( rTable.size() > 0 )
+	{
+		rTable.clear();
+	}
 }
 
 void 
 RoutingTable::clearDryRoutingTable()
 {
-	dryTable.clear();
+	if (dryTable.size()>0 )
+	{
+		dryTable.clear();
+	}
 }
 
diff --git a/nlsr_rtc.cpp b/nlsr_rtc.cpp
index fecc6bc..4dabf6a 100644
--- a/nlsr_rtc.cpp
+++ b/nlsr_rtc.cpp
@@ -42,6 +42,60 @@
 	}
 }
 
+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()
 {
@@ -53,17 +107,221 @@
 }
 
 void
-LinkStateRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
+LinkStateRoutingTableCalculator::calculatePath(Map& pMap, 
+                                                  RoutingTable& rt, nlsr& pnlsr)
+{
+	cout<<"LinkStateRoutingTableCalculator::calculatePath Called"<<endl;
+	allocateAdjMatrix();
+	makeAdjMatrix(pnlsr,pMap);
+	cout<<pMap;
+	printAdjMatrix();
+	string routerName=pnlsr.getConfParameter().getRouterPrefix();
+	int sourceRouter=pMap.getMappingNoByRouterName(routerName);
+	cout<<"Calculating Router: "<< routerName <<" Mapping no: "<<sourceRouter<<endl;
+	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
+		// update NPT ( FIB )
+	}
+	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]);
+			doDijkstraPathCalculation(sourceRouter);
+			//update routing table
+			//update NPT ( FIB )
+		}
+		
+		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::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 
+LinkStateRoutingTableCalculator::allocateLinks()
+{
+	links=new int[vNoLink];
+}
+
+void LinkStateRoutingTableCalculator::allocateLinkCosts()
+{
+	linkCosts=new double[vNoLink];
+}
+
+void 
+LinkStateRoutingTableCalculator::freeLinks()
+{
+	delete [] links;
+}
+void 
+LinkStateRoutingTableCalculator::freeLinksCosts()
+{
+	delete [] linkCosts;
+}
+
+void
+HypRoutingTableCalculator::calculatePath(Map& pMap, 
+                                                  RoutingTable& rt, nlsr& pnlsr)
 {
 }
 
 void
-HypRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
-{
-}
-
-void
-HypDryRoutingTableCalculator::calculatePath(Map& pMap, RoutingTable& rt, nlsr& pnlsr)
+HypDryRoutingTableCalculator::calculatePath(Map& pMap, 
+                                                  RoutingTable& rt, nlsr& pnlsr)
 {
 }
 
diff --git a/nlsr_rtc.hpp b/nlsr_rtc.hpp
index 5b5cc3b..3efc665 100644
--- a/nlsr_rtc.hpp
+++ b/nlsr_rtc.hpp
@@ -23,10 +23,14 @@
 	{
 		numOfRouter=rn;
 	}
-
+protected:
 	void allocateAdjMatrix();
 	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);
 
 protected:
 	double ** adjMatrix;
@@ -37,11 +41,48 @@
 {
 public:
 	LinkStateRoutingTableCalculator(int rn)
+		: EMPTY_PARENT(-12345)
+		, INF_DISTANCE(2147483647)
+		, NO_MAPPING_NUM(-1)
 	{
 		numOfRouter=rn;
 	}
+	void setNoLink(int nl)
+	{
+		vNoLink=nl;
+	}
 
 	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 allocateParent();
+	void allocateDistance();
+	void freeParent();
+	void freeDistance();
+
+	void allocateLinks();
+	void allocateLinkCosts();
+	void freeLinks();
+	void freeLinksCosts();
+	
+
+private:	
+	int *parent;
+	double *distance;
+
+	int vNoLink;
+	int *links;
+	double *linkCosts;
+	const int EMPTY_PARENT;
+	const double INF_DISTANCE;
+	const int NO_MAPPING_NUM;
 
 };
 
diff --git a/nlsr_sm.hpp b/nlsr_sm.hpp
index eaae848..542203b 100644
--- a/nlsr_sm.hpp
+++ b/nlsr_sm.hpp
@@ -1,6 +1,13 @@
 #ifndef NLSR_SM_HPP
 #define NLSR_SM_HPP
 
+#include<list>
+#include<string>
+#include <ndn-cpp-dev/face.hpp>
+
+
+using namespace std;
+
 class SequencingManager
 {
 public:
diff --git a/nlsr_test.cpp b/nlsr_test.cpp
index 4303f89..f9e39d7 100644
--- a/nlsr_test.cpp
+++ b/nlsr_test.cpp
@@ -54,7 +54,16 @@
 							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));
 	
 	
 }
