diff --git a/src/nlsr_lsa.hpp b/src/nlsr_lsa.hpp
index e7ab561..24bf73d 100644
--- a/src/nlsr_lsa.hpp
+++ b/src/nlsr_lsa.hpp
@@ -6,204 +6,212 @@
 #include "nlsr_npl.hpp"
 #include "nlsr_adl.hpp"
 
-namespace nlsr {
+namespace nlsr
+{
 
-using namespace std;
-using namespace ndn;
+    using namespace std;
+    using namespace ndn;
 
-class Lsa{
-public:
-	Lsa()
-		: origRouter()
-		, lsSeqNo()
-		, lifeTime()
-		, lsaExpiringEventId()
-	{
-	}	
+    class Lsa
+    {
+    public:
+        Lsa()
+            : origRouter()
+            , lsSeqNo()
+            , lifeTime()
+            , lsaExpiringEventId()
+        {
+        }
 
 
-	void setLsType(uint8_t lst)
-	{
-		lsType=lst;
-	}
+        void setLsType(uint8_t lst)
+        {
+            lsType=lst;
+        }
 
-	uint8_t getLsType()
-	{
-		return lsType;
-	}
+        uint8_t getLsType()
+        {
+            return lsType;
+        }
 
-	void setLsSeqNo(uint32_t lsn)
-	{
-		lsSeqNo=lsn;
-	}
+        void setLsSeqNo(uint32_t lsn)
+        {
+            lsSeqNo=lsn;
+        }
 
-	uint32_t getLsSeqNo()
-	{
-		return lsSeqNo;
-	}
+        uint32_t getLsSeqNo()
+        {
+            return lsSeqNo;
+        }
 
-	string& getOrigRouter()
-	{
-		return origRouter;
-	}
+        string& getOrigRouter()
+        {
+            return origRouter;
+        }
 
-	void setOrigRouter(string& org)
-	{
-		origRouter=org;
-	}
+        void setOrigRouter(string& org)
+        {
+            origRouter=org;
+        }
 
-	uint32_t getLifeTime()
-	{
-		return lifeTime;
-	}
+        uint32_t getLifeTime()
+        {
+            return lifeTime;
+        }
 
-	void setLifeTime(uint32_t lt)
-	{
-		lifeTime=lt;
-	}
+        void setLifeTime(uint32_t lt)
+        {
+            lifeTime=lt;
+        }
 
-	void setLsaExpiringEventId(ndn::EventId leei)
-	{
-		lsaExpiringEventId=leei;
-	}
+        void setLsaExpiringEventId(ndn::EventId leei)
+        {
+            lsaExpiringEventId=leei;
+        }
 
-	ndn::EventId getLsaExpiringEventId()
-	{
-		return lsaExpiringEventId;
-	}
-	
-	
-protected:
-	string origRouter;
-	uint8_t lsType;
-	uint32_t lsSeqNo;
-	uint32_t lifeTime;
-	ndn::EventId lsaExpiringEventId;
-};
+        ndn::EventId getLsaExpiringEventId()
+        {
+            return lsaExpiringEventId;
+        }
 
-class NameLsa:public Lsa{
-public:
-	NameLsa()
-		: Lsa()
-		, npl()
-	{
-		setLsType(1);
-	}
 
-	NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl);
+    protected:
+        string origRouter;
+        uint8_t lsType;
+        uint32_t lsSeqNo;
+        uint32_t lifeTime;
+        ndn::EventId lsaExpiringEventId;
+    };
 
-	Npl& getNpl(){
-		return npl;
-	}
+    class NameLsa:public Lsa
+    {
+    public:
+        NameLsa()
+            : Lsa()
+            , npl()
+        {
+            setLsType(1);
+        }
 
-	void addNameToLsa(string& name)
-	{
-		npl.insertIntoNpl(name);
-	}
+        NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl);
 
-	void removeNameFromLsa(string& name)
-	{
-		npl.removeFromNpl(name);
-	}
+        Npl& getNpl()
+        {
+            return npl;
+        }
 
-	string getNameLsaKey();
+        void addNameToLsa(string& name)
+        {
+            npl.insertIntoNpl(name);
+        }
 
-	string getNameLsaData();
-	
-private:
-	Npl npl;
-	
-};
+        void removeNameFromLsa(string& name)
+        {
+            npl.removeFromNpl(name);
+        }
 
-std::ostream& 
-operator<<(std::ostream& os, NameLsa& nLsa);
+        string getNameLsaKey();
 
-class AdjLsa: public Lsa{
-public:
-	AdjLsa()
-		: Lsa()
-		, adl()
-	{
-		setLsType(2);
-	}
+        string getNameLsaData();
 
-	AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, 
-	                                                        uint32_t nl ,Adl padl);
-	Adl& getAdl(){
-		return adl;
-	}
+    private:
+        Npl npl;
 
-	void addAdjacentToLsa(Adjacent adj)
-	{
-		adl.insert(adj);
-	}
-	string getAdjLsaKey();
-	string getAdjLsaData();
-	uint32_t getNoLink()
-	{
-		return noLink;
-	}
+    };
 
-	bool isLsaContentEqual(AdjLsa& alsa);
-	void addNptEntriesForAdjLsa(Nlsr& pnlsr);
-	void removeNptEntriesForAdjLsa(Nlsr& pnlsr);
+    std::ostream&
+    operator<<(std::ostream& os, NameLsa& nLsa);
 
-private:
-	uint32_t noLink;
-	Adl adl;
-};
+    class AdjLsa: public Lsa
+    {
+    public:
+        AdjLsa()
+            : Lsa()
+            , adl()
+        {
+            setLsType(2);
+        }
 
-std::ostream& 
-operator<<(std::ostream& os, AdjLsa& aLsa);
+        AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+               uint32_t nl ,Adl padl);
+        Adl& getAdl()
+        {
+            return adl;
+        }
 
-class CorLsa:public Lsa{
-public:
-	CorLsa()
-		:Lsa()
-	{
-		setLsType(3);
-	}
+        void addAdjacentToLsa(Adjacent adj)
+        {
+            adl.insert(adj);
+        }
+        string getAdjLsaKey();
+        string getAdjLsaData();
+        uint32_t getNoLink()
+        {
+            return noLink;
+        }
 
-	CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
-	      																							, double r, double theta);
-	string getCorLsaKey();
-	string getCorLsaData();
-	
-	double getCorRadius()
-	{
-		if ( corRad >= 0 )
-		{	
-			return corRad;
-		}
-		else 
-		{
-			return -1;
-		}
-	}
-	
-	void setCorRadius(double cr)
-	{
-		corRad=cr;
-	}
+        bool isLsaContentEqual(AdjLsa& alsa);
+        void addNptEntriesForAdjLsa(Nlsr& pnlsr);
+        void removeNptEntriesForAdjLsa(Nlsr& pnlsr);
 
-	double getCorTheta()
-	{
-		return corTheta;
-	}
+    private:
+        uint32_t noLink;
+        Adl adl;
+    };
 
-	void setCorTheta(double ct){
-		corTheta=ct;
-	}
+    std::ostream&
+    operator<<(std::ostream& os, AdjLsa& aLsa);
 
-	bool isLsaContentEqual(CorLsa& clsa);
-private:
-	double corRad;
-	double corTheta;
+    class CorLsa:public Lsa
+    {
+    public:
+        CorLsa()
+            :Lsa()
+        {
+            setLsType(3);
+        }
 
-};
+        CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
+               , double r, double theta);
+        string getCorLsaKey();
+        string getCorLsaData();
 
-std::ostream& 
-operator<<(std::ostream& os, CorLsa& cLsa);
+        double getCorRadius()
+        {
+            if ( corRad >= 0 )
+            {
+                return corRad;
+            }
+            else
+            {
+                return -1;
+            }
+        }
+
+        void setCorRadius(double cr)
+        {
+            corRad=cr;
+        }
+
+        double getCorTheta()
+        {
+            return corTheta;
+        }
+
+        void setCorTheta(double ct)
+        {
+            corTheta=ct;
+        }
+
+        bool isLsaContentEqual(CorLsa& clsa);
+    private:
+        double corRad;
+        double corTheta;
+
+    };
+
+    std::ostream&
+    operator<<(std::ostream& os, CorLsa& cLsa);
 
 
 }//namespace nlsr
