diff --git a/src/lsa.cpp b/src/lsa.cpp
index 5f76eda..2ad95c5 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -4,6 +4,8 @@
 #include <algorithm>
 #include <cmath>
 #include <limits>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
 
 #include "nlsr.hpp"
 #include "lsa.hpp"
@@ -17,23 +19,24 @@
 using namespace std;
 
 
-string
+const ndn::Name
 NameLsa::getKey() const
 {
-  string key;
-  key = m_origRouter + "/" + boost::lexical_cast<std::string>(1);
+  ndn::Name key = m_origRouter;
+  key.append("name");
   return key;
 }
 
-NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+NameLsa::NameLsa(const ndn::Name& origR, const string& lst, uint32_t lsn,
+                 uint32_t lt,
                  NamePrefixList& npl)
 {
   m_origRouter = origR;
   m_lsType = lst;
   m_lsSeqNo = lsn;
   m_lifeTime = lt;
-  std::list<string> nl = npl.getNameList();
-  for (std::list<string>::iterator it = nl.begin(); it != nl.end(); it++)
+  std::list<ndn::Name>& nl = npl.getNameList();
+  for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++)
   {
     addName((*it));
   }
@@ -43,44 +46,45 @@
 NameLsa::getData()
 {
   string nameLsaData;
-  nameLsaData = m_origRouter + "|" + boost::lexical_cast<std::string>(1) + "|"
+  nameLsaData = m_origRouter.toUri() + "|" + "name" + "|"
                 + boost::lexical_cast<std::string>(m_lsSeqNo) + "|"
                 + boost::lexical_cast<std::string>(m_lifeTime);
   nameLsaData += "|";
   nameLsaData += boost::lexical_cast<std::string>(m_npl.getSize());
-  std::list<string> nl = m_npl.getNameList();
-  for (std::list<string>::iterator it = nl.begin(); it != nl.end(); it++)
+  std::list<ndn::Name> nl = m_npl.getNameList();
+  for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++)
   {
     nameLsaData += "|";
-    nameLsaData += (*it);
+    nameLsaData += (*it).toUri();
   }
   return nameLsaData + "|";
 }
 
 bool
-NameLsa::initializeFromContent(string content)
+NameLsa::initializeFromContent(const std::string& content)
 {
   uint32_t numName = 0;
-  Tokenizer nt(content, "|");
-  m_origRouter = nt.getNextToken();
-  if (m_origRouter.empty())
+  boost::char_separator<char> sep("|");
+  boost::tokenizer<boost::char_separator<char> >tokens(content, sep);
+  boost::tokenizer<boost::char_separator<char> >::iterator tok_iter =
+                                               tokens.begin();
+  m_origRouter = ndn::Name(*tok_iter++);
+  if (!(m_origRouter.size() > 0))
   {
     return false;
   }
-  try
-  {
-    m_lsType = boost::lexical_cast<uint8_t>(nt.getNextToken());
-    m_lsSeqNo = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    m_lifeTime = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    numName = boost::lexical_cast<uint32_t>(nt.getNextToken());
+  try {
+    m_lsType = *tok_iter++;
+    m_lsSeqNo = boost::lexical_cast<uint32_t>(*tok_iter++);
+    m_lifeTime = boost::lexical_cast<uint32_t>(*tok_iter++);
+    numName = boost::lexical_cast<uint32_t>(*tok_iter++);
   }
-  catch (std::exception& e)
-  {
+  catch (std::exception& e) {
     return false;
   }
   for (uint32_t i = 0; i < numName; i++)
   {
-    string name = nt.getNextToken();
+    string name(*tok_iter++);
     addName(name);
   }
   return true;
@@ -96,13 +100,13 @@
 {
   os << "Name Lsa: " << endl;
   os << "  Origination Router: " << nLsa.getOrigRouter() << endl;
-  os << "  Ls Type: " << (unsigned short)nLsa.getLsType() << endl;
+  os << "  Ls Type: " << nLsa.getLsType() << endl;
   os << "  Ls Seq No: " << (unsigned int)nLsa.getLsSeqNo() << endl;
   os << "  Ls Lifetime: " << (unsigned int)nLsa.getLifeTime() << endl;
   os << "  Names: " << endl;
   int i = 1;
-  std::list<string> nl = nLsa.getNpl().getNameList();
-  for (std::list<string>::iterator it = nl.begin(); it != nl.end(); it++)
+  std::list<ndn::Name> nl = nLsa.getNpl().getNameList();
+  for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++)
   {
     os << "    Name " << i << ": " << (*it) << endl;
   }
@@ -111,7 +115,8 @@
 
 
 
-CoordinateLsa::CoordinateLsa(string origR, uint8_t lst, uint32_t lsn,
+CoordinateLsa::CoordinateLsa(const ndn::Name& origR, const string lst,
+                             uint32_t lsn,
                              uint32_t lt
                              , double r, double theta)
 {
@@ -123,11 +128,11 @@
   m_corTheta = theta;
 }
 
-string
+const ndn::Name
 CoordinateLsa::getKey() const
 {
-  string key;
-  key = m_origRouter + "/" + boost::lexical_cast<std::string>(3);
+  ndn::Name key = m_origRouter;
+  key.append("coordinate");
   return key;
 }
 
@@ -144,8 +149,9 @@
 CoordinateLsa::getData()
 {
   string corLsaData;
-  corLsaData = m_origRouter + "|";
-  corLsaData += (boost::lexical_cast<std::string>(3) + "|");
+  corLsaData = m_origRouter.toUri() + "|";
+  corLsaData += "coordinate";
+  corLsaData += "|";
   corLsaData += (boost::lexical_cast<std::string>(m_lsSeqNo) + "|");
   corLsaData += (boost::lexical_cast<std::string>(m_lifeTime) + "|");
   corLsaData += (boost::lexical_cast<std::string>(m_corRad) + "|");
@@ -154,24 +160,25 @@
 }
 
 bool
-CoordinateLsa::initializeFromContent(string content)
+CoordinateLsa::initializeFromContent(const std::string& content)
 {
-  Tokenizer nt(content, "|");
-  m_origRouter = nt.getNextToken();
-  if (m_origRouter.empty())
+  boost::char_separator<char> sep("|");
+  boost::tokenizer<boost::char_separator<char> >tokens(content, sep);
+  boost::tokenizer<boost::char_separator<char> >::iterator tok_iter =
+                                               tokens.begin();
+  m_origRouter = ndn::Name(*tok_iter++);
+  if (!(m_origRouter.size() > 0))
   {
     return false;
   }
-  try
-  {
-    m_lsType   = boost::lexical_cast<uint8_t>(nt.getNextToken());
-    m_lsSeqNo  = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    m_lifeTime = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    m_corRad   = boost::lexical_cast<double>(nt.getNextToken());
-    m_corTheta = boost::lexical_cast<double>(nt.getNextToken());
+  try {
+    m_lsType   = *tok_iter++;
+    m_lsSeqNo  = boost::lexical_cast<uint32_t>(*tok_iter++);
+    m_lifeTime = boost::lexical_cast<uint32_t>(*tok_iter++);
+    m_corRad   = boost::lexical_cast<double>(*tok_iter++);
+    m_corTheta = boost::lexical_cast<double>(*tok_iter++);
   }
-  catch (std::exception& e)
-  {
+  catch (std::exception& e) {
     return false;
   }
   return true;
@@ -182,7 +189,7 @@
 {
   os << "Cor Lsa: " << endl;
   os << "  Origination Router: " << cLsa.getOrigRouter() << endl;
-  os << "  Ls Type: " << (unsigned short)cLsa.getLsType() << endl;
+  os << "  Ls Type: " << cLsa.getLsType() << endl;
   os << "  Ls Seq No: " << (unsigned int)cLsa.getLsSeqNo() << endl;
   os << "  Ls Lifetime: " << (unsigned int)cLsa.getLifeTime() << endl;
   os << "    Hyperbolic Radius: " << cLsa.getCorRadius() << endl;
@@ -191,7 +198,8 @@
 }
 
 
-AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+AdjLsa::AdjLsa(const ndn::Name& origR, const string& lst, uint32_t lsn,
+               uint32_t lt,
                uint32_t nl , AdjacencyList& adl)
 {
   m_origRouter = origR;
@@ -209,11 +217,11 @@
   }
 }
 
-string
-AdjLsa::getKey()
+const ndn::Name
+AdjLsa::getKey() const
 {
-  string key;
-  key = m_origRouter + "/" + boost::lexical_cast<std::string>(2);
+  ndn::Name key = m_origRouter;
+  key.append("adjacency");
   return key;
 }
 
@@ -228,7 +236,7 @@
 AdjLsa::getData()
 {
   string adjLsaData;
-  adjLsaData = m_origRouter + "|" + boost::lexical_cast<std::string>(2) + "|"
+  adjLsaData = m_origRouter.toUri() + "|" + "adjacency" + "|"
                + boost::lexical_cast<std::string>(m_lsSeqNo) + "|"
                + boost::lexical_cast<std::string>(m_lifeTime);
   adjLsaData += "|";
@@ -237,7 +245,7 @@
   for (std::list<Adjacent>::iterator it = al.begin(); it != al.end(); it++)
   {
     adjLsaData += "|";
-    adjLsaData += (*it).getName();
+    adjLsaData += (*it).getName().toUri();
     adjLsaData += "|";
     adjLsaData += boost::lexical_cast<std::string>((*it).getConnectingFace());
     adjLsaData += "|";
@@ -247,38 +255,37 @@
 }
 
 bool
-AdjLsa::initializeFromContent(string content)
+AdjLsa::initializeFromContent(const std::string& content)
 {
   uint32_t numLink = 0;
-  Tokenizer nt(content, "|");
-  m_origRouter = nt.getNextToken();
-  if (m_origRouter.empty())
+  boost::char_separator<char> sep("|");
+  boost::tokenizer<boost::char_separator<char> >tokens(content, sep);
+  boost::tokenizer<boost::char_separator<char> >::iterator tok_iter =
+                                               tokens.begin();
+  m_origRouter = ndn::Name(*tok_iter++);
+  if (!(m_origRouter.size() > 0))
   {
     return false;
   }
-  try
-  {
-    m_lsType   = boost::lexical_cast<uint8_t>(nt.getNextToken());
-    m_lsSeqNo  = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    m_lifeTime = boost::lexical_cast<uint32_t>(nt.getNextToken());
-    numLink    = boost::lexical_cast<uint32_t>(nt.getNextToken());
+  try {
+    m_lsType   = *tok_iter++;
+    m_lsSeqNo  = boost::lexical_cast<uint32_t>(*tok_iter++);
+    m_lifeTime = boost::lexical_cast<uint32_t>(*tok_iter++);
+    numLink    = boost::lexical_cast<uint32_t>(*tok_iter++);
   }
-  catch (std::exception& e)
-  {
+  catch (std::exception& e) {
     return false;
   }
   for (uint32_t 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());
+    try {
+      string adjName(*tok_iter++);
+      int connectingFace = boost::lexical_cast<int>(*tok_iter++);
+      double linkCost = boost::lexical_cast<double>(*tok_iter++);
       Adjacent adjacent(adjName, connectingFace, linkCost, 0, 0);
       addAdjacent(adjacent);
     }
-    catch (std::exception& e)
-    {
+    catch (std::exception& e) {
       return false;
     }
   }
@@ -291,8 +298,7 @@
 {
   if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
   {
-    pnlsr.getNamePrefixTable().addEntry(getOrigRouter(), getOrigRouter(),
-                                                 pnlsr);
+    pnlsr.getNamePrefixTable().addEntry(getOrigRouter(), getOrigRouter());
   }
 }
 
@@ -302,7 +308,7 @@
 {
   if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix())
   {
-    pnlsr.getNamePrefixTable().removeEntry(getOrigRouter(), getOrigRouter(), pnlsr);
+    pnlsr.getNamePrefixTable().removeEntry(getOrigRouter(), getOrigRouter());
   }
 }
 
@@ -313,7 +319,7 @@
 {
   os << "Adj Lsa: " << endl;
   os << "  Origination Router: " << aLsa.getOrigRouter() << endl;
-  os << "  Ls Type: " << (unsigned short)aLsa.getLsType() << endl;
+  os << "  Ls Type: " << aLsa.getLsType() << endl;
   os << "  Ls Seq No: " << (unsigned int)aLsa.getLsSeqNo() << endl;
   os << "  Ls Lifetime: " << (unsigned int)aLsa.getLifeTime() << endl;
   os << "  No Link: " << (unsigned int)aLsa.getNoLink() << endl;
