diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index 4ceaa82..5666ed0 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -109,7 +109,6 @@
 
   for (size_t i = 0; i < ourList.size(); i++) {
     if (*(ourList[i]) != *(theirList[i])) {
-      std::cout << *ourList[i] << ":" << *theirList[i];
       return false;
     }
   }
diff --git a/src/lsa.cpp b/src/lsa.cpp
index 9c05710..afb76a1 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -38,6 +38,15 @@
 
 INIT_LOGGER("Lsa");
 
+std::string
+Lsa::getData() const
+{
+  std::ostringstream os;
+  os << m_origRouter << "|" << getType() << "|" << m_lsSeqNo << "|"
+     << ndn::time::toIsoString(m_expirationTimePoint) << "|";
+  return os.str();
+}
+
 const ndn::Name
 NameLsa::getKey() const
 {
@@ -59,11 +68,10 @@
 }
 
 std::string
-NameLsa::getData() const
+NameLsa::serialize() const
 {
   std::ostringstream os;
-  os << m_origRouter << "|" << Lsa::Type::NAME << "|" << m_lsSeqNo << "|"
-     << ndn::time::toIsoString(m_expirationTimePoint) << "|" << m_npl.size();
+  os << getData() << m_npl.size();
   for (const auto& name : m_npl.getNames()) {
     os << "|" << name;
   }
@@ -165,17 +173,13 @@
 }
 
 std::string
-CoordinateLsa::getData() const
+CoordinateLsa::serialize() const
 {
   std::ostringstream os;
-  os << m_origRouter << "|" << Lsa::Type::COORDINATE << "|" << m_lsSeqNo << "|"
-     << ndn::time::toIsoString(m_expirationTimePoint) << "|" << m_corRad << "|"
-     << m_angles.size() << "|";
-
+  os << getData() << m_corRad << "|" << m_angles.size() << "|";
   for (const auto& angle: m_angles) {
     os << angle << "|";
   }
-
   return os.str();
 }
 
@@ -258,11 +262,10 @@
 }
 
 std::string
-AdjLsa::getData() const
+AdjLsa::serialize() const
 {
   std::ostringstream os;
-  os << m_origRouter << "|" << Lsa::Type::ADJACENCY << "|" << m_lsSeqNo << "|"
-     << ndn::time::toIsoString(m_expirationTimePoint) << "|" << m_adl.size();
+  os << getData() << m_adl.size();
   for (const auto& adjacent : m_adl.getAdjList()) {
     os << "|" << adjacent.getName() << "|" << adjacent.getFaceUri()
        << "|" << adjacent.getLinkCost();
diff --git a/src/lsa.hpp b/src/lsa.hpp
index afd97e7..72ca145 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -107,13 +107,24 @@
     return m_expiringEventId;
   }
 
+  /*! \brief Return the data that this LSA represents.
+   */
   virtual std::string
-  getData() const = 0;
+  serialize() const = 0;
 
   virtual bool
   initializeFromContent(const std::string& content) = 0;
 
 protected:
+  /*! Get data common to all LSA types.
+
+    This method should be called by all LSA classes in their
+    serialize() method.
+   */
+  std::string
+  getData() const;
+
+protected:
   ndn::Name m_origRouter;
   uint32_t m_lsSeqNo;
   ndn::time::system_clock::TimePoint m_expirationTimePoint;
@@ -168,15 +179,6 @@
   const ndn::Name
   getKey() const;
 
-  /*! \brief Returns the data that this name LSA has.
-
-    Format is: \<original router
-    prefix\>|name|\<seq. no.\>|\<exp. time\>|\<prefix 1\>|\<prefix
-    2\>|...|\<prefix n\>|
-   */
-  std::string
-  getData() const override;
-
   /*! \brief Initializes this LSA object with content's data.
 
     \param content The data (e.g. name prefixes) to initialize this LSA with.
@@ -194,6 +196,15 @@
   void
   writeLog();
 
+  /*! \brief Returns the data that this name LSA has.
+
+    Format is: \<original router
+    prefix\>|name|\<seq. no.\>|\<exp. time\>|\<prefix 1\>|\<prefix
+    2\>|...|\<prefix n\>|
+   */
+  std::string
+  serialize() const override;
+
 private:
   NamePrefixList m_npl;
 };
@@ -238,16 +249,6 @@
   const ndn::Name
   getKey() const;
 
-  /*! \brief Returns the data this adjacency LSA has.
-
-    The format is: \<original
-    router\>|adjacency|\<seq. no.\>|\<exp. time\>|\<size\>|\<adjacency prefix
-    1\>|\<face uri 1\>|\<cost 1\>|...|\<adjacency prefix n\>|\<face uri
-    n\>|\<cost n\>|
-   */
-  std::string
-  getData() const override;
-
   /*! \brief Initializes this adj. LSA from the supplied content.
 
     \param content The content that this LSA is to have, formatted
@@ -279,7 +280,6 @@
   void
   writeLog();
 
-public:
   const_iterator
   begin() const
   {
@@ -292,6 +292,16 @@
     return m_adl.end();
   }
 
+  /*! \brief Returns the data this adjacency LSA has.
+
+    The format is: \<original
+    router\>|adjacency|\<seq. no.\>|\<exp. time\>|\<size\>|\<adjacency prefix
+    1\>|\<face uri 1\>|\<cost 1\>|...|\<adjacency prefix n\>|\<face uri
+    n\>|\<cost n\>|
+   */
+  std::string
+  serialize() const override;
+
 private:
   uint32_t m_noLink;
   AdjacencyList m_adl;
@@ -318,14 +328,6 @@
   const ndn::Name
   getKey() const;
 
-  /*! \brief Returns the data that this coordinate LSA represents.
-
-    The format is: \<original
-    router\>|coordinate|\<seq. no.\>|\<exp. time\>|\<radians\>|\<theta\>|
-  */
-  std::string
-  getData() const override;
-
   /*! \brief Initializes this coordinate LSA with the data in content.
 
     \param content The string content that is used to build the LSA.
@@ -367,6 +369,14 @@
   void
   writeLog();
 
+  /*! \brief Returns the data that this coordinate LSA represents.
+
+    The format is: \<original
+    router\>|coordinate|\<seq. no.\>|\<exp. time\>|\<radians\>|\<theta\>|
+  */
+  std::string
+  serialize() const override;
+
 private:
   double m_corRad;
   std::vector<double> m_angles;
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 2661813..327c3f1 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1097,7 +1097,7 @@
   NameLsa*  nameLsa = m_nlsr.getLsdb().findNameLsa(lsaKey);
   if (nameLsa != 0) {
     if (nameLsa->getLsSeqNo() == seqNo) {
-      std::string content = nameLsa->getData();
+      std::string content = nameLsa->serialize();
       putLsaData(interest,content);
       // increment SENT_NAME_LSA_DATA
       lsaIncrementSignal(Statistics::PacketType::SENT_NAME_LSA_DATA);
@@ -1131,7 +1131,7 @@
   AdjLsa* adjLsa = m_nlsr.getLsdb().findAdjLsa(lsaKey);
   if (adjLsa != 0) {
     if (adjLsa->getLsSeqNo() == seqNo) {
-      std::string content = adjLsa->getData();
+      std::string content = adjLsa->serialize();
       putLsaData(interest,content);
       // increment SENT_ADJ_LSA_DATA
       lsaIncrementSignal(Statistics::PacketType::SENT_ADJ_LSA_DATA);
@@ -1165,7 +1165,7 @@
   CoordinateLsa* corLsa = m_nlsr.getLsdb().findCoordinateLsa(lsaKey);
   if (corLsa != 0) {
     if (corLsa->getLsSeqNo() == seqNo) {
-      std::string content = corLsa->getData();
+      std::string content = corLsa->serialize();
       putLsaData(interest,content);
       // increment SENT_COORD_LSA_DATA
       lsaIncrementSignal(Statistics::PacketType::SENT_COORD_LSA_DATA);
