diff --git a/src/nlsr_sm.cpp b/src/nlsr_sm.cpp
index cae7f60..efc7614 100644
--- a/src/nlsr_sm.cpp
+++ b/src/nlsr_sm.cpp
@@ -10,87 +10,87 @@
 namespace nlsr
 {
 
-    using namespace std;
+  using namespace std;
 
-    void
-    SequencingManager::splittSequenceNo(uint64_t seqNo)
-    {
-        combinedSeqNo=seqNo;
-        adjLsaSeq = (combinedSeqNo & 0xFFFFF);
-        corLsaSeq = ((combinedSeqNo >> 20) & 0xFFFFF);
-        nameLsaSeq = ((combinedSeqNo >> 40) & 0xFFFFF);
-    }
+  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::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::writeSeqNoToFile()
+  {
+    std::ofstream outputFile(seqFileNameWithPath.c_str(),ios::binary);
+    outputFile<<combinedSeqNo;
+    outputFile.close();
+  }
 
-    void
-    SequencingManager::initiateSeqNoFromFile()
+  void
+  SequencingManager::initiateSeqNoFromFile()
+  {
+    cout<<"Seq File Name: "<< seqFileNameWithPath<<endl;
+    std::ifstream inputFile(seqFileNameWithPath.c_str(),ios::binary);
+    if ( inputFile.good() )
     {
-        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);
-        }
+      inputFile>>combinedSeqNo;
+      splittSequenceNo(combinedSeqNo);
+      adjLsaSeq+=10;
+      corLsaSeq+=10;
+      nameLsaSeq+=10;
+      combineSequenceNo();
+      inputFile.close();
     }
+    else
+    {
+      splittSequenceNo(0);
+    }
+  }
 
-    void
-    SequencingManager::setSeqFileName(string filePath)
+  void
+  SequencingManager::setSeqFileName(string filePath)
+  {
+    seqFileNameWithPath=filePath;
+    if( seqFileNameWithPath.empty() )
     {
-        seqFileNameWithPath=filePath;
-        if( seqFileNameWithPath.empty() )
-        {
-            seqFileNameWithPath=getUserHomeDirectory();
-        }
-        seqFileNameWithPath=seqFileNameWithPath+"/nlsrSeqNo.txt";
+      seqFileNameWithPath=getUserHomeDirectory();
     }
+    seqFileNameWithPath=seqFileNameWithPath+"/nlsrSeqNo.txt";
+  }
 
-    string
-    SequencingManager::getUserHomeDirectory()
+  string
+  SequencingManager::getUserHomeDirectory()
+  {
+    string homeDirPath(getpwuid(getuid())->pw_dir);
+    if( homeDirPath.empty() )
     {
-        string homeDirPath(getpwuid(getuid())->pw_dir);
-        if( homeDirPath.empty() )
-        {
-            homeDirPath = getenv("HOME");
-        }
-        return homeDirPath;
+      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;
-    }
+  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
 
