diff --git a/src/sequencing-manager.cpp b/src/sequencing-manager.cpp
index 1c91700..6eaab5d 100644
--- a/src/sequencing-manager.cpp
+++ b/src/sequencing-manager.cpp
@@ -25,6 +25,7 @@
 #include <pwd.h>
 #include <cstdlib>
 #include <unistd.h>
+#include <boost/algorithm/string.hpp>
 
 #include "sequencing-manager.hpp"
 #include "logger.hpp"
@@ -36,28 +37,15 @@
 using namespace std;
 
 void
-SequencingManager::splitSequenceNo(uint64_t seqNo)
-{
-  m_combinedSeqNo = seqNo;
-  m_adjLsaSeq = (m_combinedSeqNo & 0xFFFFF);
-  m_corLsaSeq = ((m_combinedSeqNo >> 20) & 0xFFFFF);
-  m_nameLsaSeq = ((m_combinedSeqNo >> 40) & 0xFFFFFF);
-}
-
-void
-SequencingManager::combineSequenceNo()
-{
-  m_combinedSeqNo = 0;
-  m_combinedSeqNo = m_combinedSeqNo | m_adjLsaSeq;
-  m_combinedSeqNo = m_combinedSeqNo | (m_corLsaSeq << 20);
-  m_combinedSeqNo = m_combinedSeqNo | (m_nameLsaSeq << 40);
-}
-
-void
 SequencingManager::writeSeqNoToFile() const
 {
-  std::ofstream outputFile(m_seqFileNameWithPath.c_str(), ios::binary);
-  outputFile << m_combinedSeqNo;
+  writeLog();
+  std::ofstream outputFile(m_seqFileNameWithPath.c_str());
+  std::ostringstream os;
+  os << "NameLsaSeq " << std::to_string(m_nameLsaSeq) << "\n"
+     << "AdjLsaSeq "  << std::to_string(m_adjLsaSeq)  << "\n"
+     << "CorLsaSeq "  << std::to_string(m_corLsaSeq);
+  outputFile << os.str();
   outputFile.close();
 }
 
@@ -65,10 +53,40 @@
 SequencingManager::initiateSeqNoFromFile(int hypState)
 {
   _LOG_DEBUG("Seq File Name: " << m_seqFileNameWithPath);
-  std::ifstream inputFile(m_seqFileNameWithPath.c_str(), ios::binary);
+  std::ifstream inputFile(m_seqFileNameWithPath.c_str());
+
+  // Good checks that file is not (bad or eof or fail)
   if (inputFile.good()) {
-    inputFile >> m_combinedSeqNo;
-    splitSequenceNo(m_combinedSeqNo);
+    std::string lsaOrCombinedSeqNo;
+    uint64_t seqNo = 0;
+
+    // If file has a combined seq number, lsaOrCombinedSeqNo would hold it
+    // and seqNo will be zero everytime
+    inputFile >> lsaOrCombinedSeqNo >> seqNo;
+    m_nameLsaSeq = seqNo;
+
+    inputFile >> lsaOrCombinedSeqNo >> seqNo;
+    m_adjLsaSeq = seqNo;
+
+    inputFile >> lsaOrCombinedSeqNo >> seqNo;;
+    m_corLsaSeq = seqNo;
+
+    // File was in old format and had a combined sequence number
+    // if all of the seqNo should are still zero and
+    // lsaOrCombinedSeqNo != CorLsaSeq
+    if (m_nameLsaSeq == 0 && m_adjLsaSeq == 0 && m_corLsaSeq == 0 &&
+        lsaOrCombinedSeqNo != "CorLsaSeq") {
+      _LOG_DEBUG("Old file had combined sequence number: " << lsaOrCombinedSeqNo);
+      std::istringstream iss(lsaOrCombinedSeqNo);
+      iss >> seqNo;
+      m_adjLsaSeq = (seqNo & 0xFFFFF);
+      m_corLsaSeq = ((seqNo >> 20) & 0xFFFFF);
+      m_nameLsaSeq = ((seqNo >> 40) & 0xFFFFFF);
+    }
+
+    inputFile.close();
+
+    m_nameLsaSeq += 10;
 
     // Increment the adjacency LSA seq. no. if link-state or dry HR is enabled
     if (hypState != HYPERBOLIC_STATE_ON) {
@@ -82,43 +100,32 @@
 
     // Similarly, increment the coordinate LSA seq. no only if link-state is disabled.
     if (hypState != HYPERBOLIC_STATE_OFF) {
-      if (m_adjLsaSeq != 0 &&
-          hypState == HYPERBOLIC_STATE_ON) {
+      if (m_adjLsaSeq != 0) {
         _LOG_WARN("This router was previously configured for link-state"
                   << " routing without clearing the seq. no. file.");
         m_adjLsaSeq = 0;
       }
       m_corLsaSeq += 10;
     }
-    m_nameLsaSeq += 10;
-    combineSequenceNo();
-    inputFile.close();
   }
-  else {
-    splitSequenceNo(0);
-  }
+  writeLog();
 }
 
 void
-SequencingManager::setSeqFileName(string filePath)
+SequencingManager::setSeqFileDirectory(string filePath)
 {
   m_seqFileNameWithPath = filePath;
+
   if (m_seqFileNameWithPath.empty()) {
-    m_seqFileNameWithPath = getUserHomeDirectory();
+    string homeDirPath(getpwuid(getuid())->pw_dir);
+    if (homeDirPath.empty()) {
+      homeDirPath = getenv("HOME");
+    }
+    m_seqFileNameWithPath = homeDirPath;
   }
   m_seqFileNameWithPath = m_seqFileNameWithPath + "/nlsrSeqNo.txt";
 }
 
-string
-SequencingManager::getUserHomeDirectory()
-{
-  string homeDirPath(getpwuid(getuid())->pw_dir);
-  if (homeDirPath.empty()) {
-    homeDirPath = getenv("HOME");
-  }
-  return homeDirPath;
-}
-
 void
 SequencingManager::writeLog() const
 {
@@ -126,7 +133,6 @@
   _LOG_DEBUG("Adj LSA seq no: " << m_adjLsaSeq);
   _LOG_DEBUG("Cor LSA Seq no: " << m_corLsaSeq);
   _LOG_DEBUG("Name LSA Seq no: " << m_nameLsaSeq);
-  _LOG_DEBUG("Combined LSDB Seq no: " << m_combinedSeqNo);
 }
 
 } // namespace nlsr
