diff --git a/src/lsa.cpp b/src/lsa.cpp
index ad35a81..7ecad7a 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -19,6 +19,12 @@
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
+#include "lsa.hpp"
+#include "nlsr.hpp"
+#include "name-prefix-list.hpp"
+#include "adjacent.hpp"
+#include "logger.hpp"
+
 #include <string>
 #include <iostream>
 #include <sstream>
@@ -28,12 +34,6 @@
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp>
 
-#include "nlsr.hpp"
-#include "lsa.hpp"
-#include "name-prefix-list.hpp"
-#include "adjacent.hpp"
-#include "logger.hpp"
-
 namespace nlsr {
 
 INIT_LOGGER("Lsa");
@@ -60,9 +60,8 @@
   m_origRouter = origR;
   m_lsSeqNo = lsn;
   m_expirationTimePoint = lt;
-  std::list<ndn::Name>& nl = npl.getNameList();
-  for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++) {
-    addName((*it));
+  for (const auto& name : npl.getNames()) {
+    addName(name);
   }
 }
 
@@ -72,7 +71,7 @@
   std::ostringstream os;
   os << m_origRouter << "|" << NameLsa::TYPE_STRING << "|" << m_lsSeqNo << "|"
      << ndn::time::toIsoString(m_expirationTimePoint) << "|" << m_npl.getSize();
-  for (const auto& name : m_npl.getNameList()) {
+  for (const auto& name : m_npl.getNames()) {
     os << "|" << name;
   }
   os << "|";
@@ -127,7 +126,7 @@
   _LOG_DEBUG("  Ls Lifetime: " << m_expirationTimePoint);
   _LOG_DEBUG("  Names: ");
   int i = 1;
-  std::list<ndn::Name> nl = m_npl.getNameList();
+  std::list<ndn::Name> nl = m_npl.getNames();
   for (std::list<ndn::Name>::iterator it = nl.begin(); it != nl.end(); it++)
   {
     _LOG_DEBUG("    Name " << i << ": " << (*it));
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 99cd285..b71b48e 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -216,7 +216,7 @@
       // prefixes to the NPT.
       m_nlsr.getNamePrefixTable().addEntry(nlsa.getOrigRouter(),
                                            nlsa.getOrigRouter());
-      std::list<ndn::Name> nameList = nlsa.getNpl().getNameList();
+      std::list<ndn::Name> nameList = nlsa.getNpl().getNames();
       for (std::list<ndn::Name>::iterator it = nameList.begin(); it != nameList.end();
            it++) {
         if ((*it) != m_nlsr.getConfParameter().getRouterPrefix()) {
@@ -245,14 +245,13 @@
       nlsa.getNpl().sort();
       // Obtain the set difference of the current and the incoming
       // name prefix sets, and add those.
-      std::list<ndn::Name> nameToAdd;
-      std::set_difference(nlsa.getNpl().getNameList().begin(),
-                          nlsa.getNpl().getNameList().end(),
-                          chkNameLsa->getNpl().getNameList().begin(),
-                          chkNameLsa->getNpl().getNameList().end(),
-                          std::inserter(nameToAdd, nameToAdd.begin()));
-      for (std::list<ndn::Name>::iterator it = nameToAdd.begin();
-           it != nameToAdd.end(); ++it) {
+      std::list<ndn::Name> newNames = nlsa.getNpl().getNames();
+      std::list<ndn::Name> oldNames = chkNameLsa->getNpl().getNames();
+      std::list<ndn::Name> namesToAdd;
+      std::set_difference(newNames.begin(), newNames.end(), oldNames.begin(), oldNames.end(),
+                          std::inserter(namesToAdd, namesToAdd.begin()));
+      for (std::list<ndn::Name>::iterator it = namesToAdd.begin();
+           it != namesToAdd.end(); ++it) {
         chkNameLsa->addName((*it));
         if (nlsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
           if ((*it) != m_nlsr.getConfParameter().getRouterPrefix()) {
@@ -264,14 +263,11 @@
       chkNameLsa->getNpl().sort();
 
       // Also remove any names that are no longer being advertised.
-      std::list<ndn::Name> nameToRemove;
-      std::set_difference(chkNameLsa->getNpl().getNameList().begin(),
-                          chkNameLsa->getNpl().getNameList().end(),
-                          nlsa.getNpl().getNameList().begin(),
-                          nlsa.getNpl().getNameList().end(),
-                          std::inserter(nameToRemove, nameToRemove.begin()));
-      for (std::list<ndn::Name>::iterator it = nameToRemove.begin();
-           it != nameToRemove.end(); ++it) {
+      std::list<ndn::Name> namesToRemove;
+      std::set_difference(oldNames.begin(), oldNames.end(), newNames.begin(), newNames.end(),
+                          std::inserter(namesToRemove, namesToRemove.begin()));
+      for (std::list<ndn::Name>::iterator it = namesToRemove.begin();
+           it != namesToRemove.end(); ++it) {
         _LOG_DEBUG("Removing name LSA no longer advertised: " << (*it).toUri());
         chkNameLsa->removeName((*it));
         if (nlsa.getOrigRouter() != m_nlsr.getConfParameter().getRouterPrefix()) {
@@ -326,10 +322,9 @@
         m_nlsr.getConfParameter().getRouterPrefix()) {
       m_nlsr.getNamePrefixTable().removeEntry((*it).getOrigRouter(),
                                               (*it).getOrigRouter());
-      for (std::list<ndn::Name>::iterator nit = (*it).getNpl().getNameList().begin();
-           nit != (*it).getNpl().getNameList().end(); ++nit) {
-        if ((*nit) != m_nlsr.getConfParameter().getRouterPrefix()) {
-          m_nlsr.getNamePrefixTable().removeEntry((*nit), (*it).getOrigRouter());
+      for (const auto& name : it->getNpl().getNames()) {
+        if (name != m_nlsr.getConfParameter().getRouterPrefix()) {
+          m_nlsr.getNamePrefixTable().removeEntry(name, it->getOrigRouter());
         }
       }
     }
diff --git a/src/name-prefix-list.cpp b/src/name-prefix-list.cpp
index 0bbcbaa..742367b 100644
--- a/src/name-prefix-list.cpp
+++ b/src/name-prefix-list.cpp
@@ -19,15 +19,16 @@
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
+#include "name-prefix-list.hpp"
+
+#include "common.hpp"
+#include "logger.hpp"
+
 #include <iostream>
 #include <algorithm>
 
 #include <ndn-cxx/common.hpp>
 
-#include "common.hpp"
-#include "name-prefix-list.hpp"
-#include "logger.hpp"
-
 namespace nlsr {
 
 INIT_LOGGER("NamePrefixList");
@@ -42,58 +43,115 @@
 {
 }
 
-static bool
-nameCompare(const ndn::Name& name1, const ndn::Name& name2)
+std::vector<NamePrefixList::NamePair>::iterator
+NamePrefixList::get(const ndn::Name& name)
 {
-  return name1 == name2;
+  return std::find_if(m_names.begin(), m_names.end(),
+                      [&] (const NamePrefixList::NamePair& pair) {
+                        return name == std::get<NamePrefixList::NamePairIndex::NAME>(pair);
+                      });
+}
+
+std::vector<std::string>::iterator
+NamePrefixList::getSource(const std::string& source, std::vector<NamePair>::iterator& entry)
+{
+  return std::find_if(std::get<NamePairIndex::SOURCES>(*entry).begin(),
+                      std::get<NamePairIndex::SOURCES>(*entry).end(),
+                      [&] (const std::string& containerSource) {
+                        return source == containerSource;
+                      });
 }
 
 bool
-NamePrefixList::insert(const ndn::Name& name)
+NamePrefixList::insert(const ndn::Name& name, const std::string& source)
 {
-  std::list<ndn::Name>::iterator it = std::find_if(m_nameList.begin(),
-                                                   m_nameList.end(),
-                                                   std::bind(&nameCompare, _1 ,
-                                                   std::cref(name)));
-  if (it != m_nameList.end()) {
-    return false;
-  }
-  m_nameList.push_back(name);
-  return true;
-}
-
-bool
-NamePrefixList::remove(const ndn::Name& name)
-{
-  std::list<ndn::Name>::iterator it = std::find_if(m_nameList.begin(),
-                                                   m_nameList.end(),
-                                                   std::bind(&nameCompare, _1 ,
-                                                   std::cref(name)));
-  if (it != m_nameList.end()) {
-    m_nameList.erase(it);
+  auto pairItr = get(name);
+  if (pairItr == m_names.end()) {
+    std::vector<std::string> sources{source};
+    m_names.push_back(std::tie(name, sources));
     return true;
   }
+  else {
+    std::vector<std::string>& sources = std::get<NamePrefixList::NamePairIndex::SOURCES>(*pairItr);
+    auto sourceItr = getSource(source, pairItr);
+    if (sourceItr == sources.end()) {
+      sources.push_back(source);
+      return true;
+    }
+  }
+  return false;
+}
 
+bool
+NamePrefixList::remove(const ndn::Name& name, const std::string& source)
+{
+  auto pairItr = get(name);
+  if (pairItr != m_names.end()) {
+    std::vector<std::string>& sources = std::get<NamePrefixList::NamePairIndex::SOURCES>(*pairItr);
+    auto sourceItr = getSource(source, pairItr);
+    if (sourceItr != sources.end()) {
+      sources.erase(sourceItr);
+      if (sources.size() == 0) {
+        m_names.erase(pairItr);
+      }
+      return true;
+    }
+  }
   return false;
 }
 
 bool
 NamePrefixList::operator==(const NamePrefixList& other) const
 {
-  return m_nameList == other.getNameList();
+  return m_names == other.m_names;
 }
 
 void
 NamePrefixList::sort()
 {
-  m_nameList.sort();
+  std::sort(m_names.begin(), m_names.end());
+}
+
+std::list<ndn::Name>
+NamePrefixList::getNames() const
+{
+  std::list<ndn::Name> names;
+  for (const auto& namePair : m_names) {
+    names.push_back(std::get<NamePrefixList::NamePairIndex::NAME>(namePair));
+  }
+  return names;
+}
+
+uint32_t
+NamePrefixList::countSources(const ndn::Name& name) const
+{
+  return getSources(name).size();
+}
+
+const std::vector<std::string>
+NamePrefixList::getSources(const ndn::Name& name) const
+{
+  auto it = std::find_if(m_names.begin(), m_names.end(),
+                         [&] (const NamePrefixList::NamePair& pair) {
+                           return name == std::get<NamePrefixList::NamePairIndex::NAME>(pair);
+                         });
+  if (it != m_names.end()) {
+    return std::get<NamePrefixList::NamePairIndex::SOURCES>(*it);
+  }
+  else {
+    return std::vector<std::string>{};
+  }
 }
 
 std::ostream&
 operator<<(std::ostream& os, const NamePrefixList& list) {
   os << "Name prefix list: {\n";
-  for (const auto& name : list.getNameList()) {
-    os << name << "\n";
+  for (const auto& name : list.getNames()) {
+    os << name << "\n"
+       << "Sources:\n";
+    for (const auto& source : list.getSources(name)) {
+      os << "  " << source << "\n";
+    }
   }
   os << "}" << std::endl;
   return os;
diff --git a/src/name-prefix-list.hpp b/src/name-prefix-list.hpp
index cba76d3..5ec94ef 100644
--- a/src/name-prefix-list.hpp
+++ b/src/name-prefix-list.hpp
@@ -31,8 +31,13 @@
 namespace nlsr {
 class NamePrefixList
 {
-
 public:
+  using NamePair = std::tuple<ndn::Name, std::vector<std::string>>;
+  enum NamePairIndex {
+    NAME,
+    SOURCES
+  };
+
   NamePrefixList();
 
   ~NamePrefixList();
@@ -42,14 +47,14 @@
       \retval false If the name could not be inserted.
    */
   bool
-  insert(const ndn::Name& name);
+  insert(const ndn::Name& name, const std::string& source = "");
 
   /*! \brief removes name from NamePrefixList
       \retval true If the name is removed
       \retval false If the name failed to be removed.
    */
   bool
-  remove(const ndn::Name& name);
+  remove(const ndn::Name& name, const std::string& source = "");
 
   void
   sort();
@@ -57,27 +62,45 @@
   size_t
   getSize()
   {
-    return m_nameList.size();
+    return m_names.size();
   }
 
-  std::list<ndn::Name>&
-  getNameList()
-  {
-    return m_nameList;
-  }
-
-  const std::list<ndn::Name>&
-  getNameList() const
-  {
-    return m_nameList;
-  }
+  std::list<ndn::Name>
+  getNames() const;
 
   bool
   operator==(const NamePrefixList& other) const;
 
-private:
-  std::list<ndn::Name> m_nameList;
+  /*! Returns how many unique sources this name has.
 
+    \retval 0 if the name is not in the list, else the number of sources.
+   */
+  uint32_t
+  countSources(const ndn::Name& name) const;
+
+  /*! Returns the sources that this name has.
+
+    \retval an empty vector if the name is not in the list, else a
+    vector containing the sources.
+   */
+  const std::vector<std::string>
+  getSources(const ndn::Name& name) const;
+
+private:
+  /*! Obtain an iterator to the entry matching name.
+
+    \note We could do this quite easily inline with a lambda, but this
+    is slightly more efficient.
+   */
+  std::vector<NamePair>::iterator
+  get(const ndn::Name& name);
+
+  /*! Obtain an iterator to a specific source in an entry
+   */
+  std::vector<std::string>::iterator
+  getSource(const std::string& source, std::vector<NamePair>::iterator& entry);
+
+  std::vector<NamePair> m_names;
 };
 
 std::ostream&
diff --git a/src/publisher/lsa-publisher.cpp b/src/publisher/lsa-publisher.cpp
index a46ef60..6bfc1dc 100644
--- a/src/publisher/lsa-publisher.cpp
+++ b/src/publisher/lsa-publisher.cpp
@@ -124,7 +124,7 @@
     std::shared_ptr<tlv::LsaInfo> tlvLsaInfo = tlv::makeLsaInfo(lsa);
     tlvLsa.setLsaInfo(*tlvLsaInfo);
 
-    for (const ndn::Name& name : lsa.getNpl().getNameList()) {
+    for (const ndn::Name& name : lsa.getNpl().getNames()) {
       tlvLsa.addName(name);
     }
 
diff --git a/src/publisher/lsdb-dataset-interest-handler.cpp b/src/publisher/lsdb-dataset-interest-handler.cpp
index acd5c92..30634ac 100644
--- a/src/publisher/lsdb-dataset-interest-handler.cpp
+++ b/src/publisher/lsdb-dataset-interest-handler.cpp
@@ -133,7 +133,7 @@
     std::shared_ptr<tlv::LsaInfo> tlvLsaInfo = tlv::makeLsaInfo(lsa);
     tlvLsa.setLsaInfo(*tlvLsaInfo);
 
-    for (const ndn::Name& name : lsa.getNpl().getNameList()) {
+    for (const ndn::Name& name : lsa.getNpl().getNames()) {
       tlvLsa.addName(name);
     }
 
diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp
index c52f378..9156c7b 100644
--- a/tests/publisher/publisher-fixture.hpp
+++ b/tests/publisher/publisher-fixture.hpp
@@ -140,7 +140,7 @@
 
     std::list<ndn::Name>::const_iterator it = tlvLsa.getNames().begin();
 
-    for (const ndn::Name& name : lsa.getNpl().getNameList()) {
+    for (const ndn::Name& name : lsa.getNpl().getNames()) {
       BOOST_CHECK_EQUAL(*it, name);
       ++it;
     }
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index abd58d4..2dd6f3e 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -74,10 +74,11 @@
   void
   areNamePrefixListsEqual(NamePrefixList& lhs, NamePrefixList& rhs)
   {
+
     typedef std::list<ndn::Name> NameList;
 
-    NameList& lhsList = lhs.getNameList();
-    NameList& rhsList = rhs.getNameList();
+    NameList lhsList = lhs.getNames();
+    NameList rhsList = rhs.getNames();
 
     BOOST_REQUIRE_EQUAL(lhsList.size(), rhsList.size());
 
@@ -274,7 +275,8 @@
   BOOST_REQUIRE_EQUAL(lsdb.doesLsaExist(otherRouter + "/name", NameLsa::TYPE_STRING), true);
   NamePrefixList& nameList = lsdb.findNameLsa(otherRouter + "/name")->getNpl();
 
-  areNamePrefixListsEqual(nameList, prefixes);
+  BOOST_CHECK_EQUAL(nameList, prefixes);
+  //areNamePrefixListsEqual(nameList, prefixes);
 
   // Add a prefix: name3
   ndn::Name name3("/ndn/name3");
@@ -284,7 +286,7 @@
   lsdb.installNameLsa(addLsa);
 
   // Lsa should include name1, name2, and name3
-  areNamePrefixListsEqual(nameList, prefixes);
+  BOOST_CHECK_EQUAL(nameList, prefixes);
 
   // Remove a prefix: name2
   prefixes.remove(name2);
@@ -293,7 +295,7 @@
   lsdb.installNameLsa(removeLsa);
 
   // Lsa should include name1 and name3
-  areNamePrefixListsEqual(nameList, prefixes);
+  BOOST_CHECK_EQUAL(nameList, prefixes);
 
   // Add and remove a prefix: add name2, remove name3
   prefixes.insert(name2);
@@ -303,7 +305,7 @@
   lsdb.installNameLsa(addAndRemoveLsa);
 
   // Lsa should include name1 and name2
-  areNamePrefixListsEqual(nameList, prefixes);
+  BOOST_CHECK_EQUAL(nameList, prefixes);
 
   // Install a completely new list of prefixes
   ndn::Name name4("/ndn/name4");
@@ -317,7 +319,7 @@
   lsdb.installNameLsa(newLsa);
 
   // Lsa should include name4 and name5
-  areNamePrefixListsEqual(nameList, newPrefixes);
+  BOOST_CHECK_EQUAL(nameList, newPrefixes);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-name-prefix-list.cpp b/tests/test-name-prefix-list.cpp
index b07517f..eef0c18 100644
--- a/tests/test-name-prefix-list.cpp
+++ b/tests/test-name-prefix-list.cpp
@@ -16,19 +16,19 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- *
  **/
+
 #include "name-prefix-list.hpp"
 #include <boost/test/unit_test.hpp>
 
 namespace nlsr {
-
 namespace test {
 
 BOOST_AUTO_TEST_SUITE(TestNpl)
 
+/*
+  The NamePrefixList can have names inserted and removed from it.
+ */
 BOOST_AUTO_TEST_CASE(NplSizeAndRemove)
 {
   NamePrefixList npl1;
@@ -46,6 +46,10 @@
   BOOST_CHECK_EQUAL(npl1.getSize(), 1);
 }
 
+/*
+  Two NamePrefixLists will be considered equal if they contain the
+  same names. Sources for names are ignored.
+ */
 BOOST_AUTO_TEST_CASE(OperatorEquals)
 {
   NamePrefixList list1;
@@ -65,6 +69,106 @@
   BOOST_CHECK_EQUAL(list1, list2);
 }
 
+/*
+  The NamePrefixList will provide a container of all the names it has,
+  without the sources for those names.
+ */
+BOOST_AUTO_TEST_CASE(GetNames)
+{
+  NamePrefixList list;
+  const ndn::Name name1{"/ndn/test/prefix1"};
+  const ndn::Name name2{"/ndn/test/prefix2"};
+  const ndn::Name name3{"/ndn/test/prefix3"};
+  list.insert(name1);
+  list.insert(name2);
+  list.insert(name3);
+
+  std::vector<ndn::Name> referenceNames{name1, name2, name3};
+
+  auto names = list.getNames();
+  BOOST_REQUIRE_EQUAL(names.size(), 3);
+  // Verify that all of the names are in the list.
+  for (const auto& name : names) {
+    bool didMatch = false;
+    for (const auto& referenceName : referenceNames) {
+      didMatch = didMatch || (name == referenceName);
+    }
+    BOOST_CHECK(didMatch);
+  }
+}
+
+/*
+  The NamePrefixList will count the number of sources for a given
+  name, with zero for a non-existent name.
+ */
+BOOST_AUTO_TEST_CASE(countSources)
+{
+  NamePrefixList list;
+  const ndn::Name name1{"/ndn/test/prefix1"};
+  const ndn::Name invalidName{"/not/a/prefix"};
+  list.insert(name1, "nlsr.conf");
+  list.insert(name1, "readvertise");
+  list.insert(name1, "prefix-update");
+
+  BOOST_CHECK_EQUAL(list.countSources(name1), 3);
+  BOOST_CHECK_EQUAL(list.countSources(invalidName), 0);
+}
+
+/*
+  The NamePrefixList will return a container with all the sources for
+  a given name, with an empty container for a non-existent name.
+ */
+BOOST_AUTO_TEST_CASE(getSources)
+{
+  NamePrefixList list;
+  const ndn::Name name1{"/ndn/test/prefix1"};
+  const ndn::Name invalidName{"/not/a/prefix"};
+
+  list.insert(name1, "nlsr.conf");
+  list.insert(name1, "readvertise");
+  list.insert(name1, "prefix-update");
+  std::vector<std::string> referenceSources{"nlsr.conf", "readvertise", "prefix-update"};
+
+  const std::vector<std::string> sources = list.getSources(name1);
+  BOOST_REQUIRE_EQUAL(list.countSources(name1), 3);
+  for (const auto& source : sources) {
+    bool didMatch = false;
+    for (const auto& referenceSource : referenceSources) {
+      didMatch = didMatch || (source == referenceSource);
+    }
+    BOOST_CHECK(didMatch);
+  }
+
+  std::vector<std::string> noSources = list.getSources(invalidName);
+  BOOST_REQUIRE_EQUAL(noSources.size(), 0);
+}
+
+/*
+  The NamePrefixList will not delete a name as long as it at least one
+  source.
+ */
+BOOST_AUTO_TEST_CASE(RemainingSourcesAfterRemoval)
+{
+  NamePrefixList list;
+  const ndn::Name name1{"/ndn/test/prefix1"};
+  list.insert(name1, "nlsr.conf");
+  list.insert(name1, "readvertise");
+  list.insert(name1, "prefix-update");
+
+  list.remove(name1, "prefix-update");
+
+  std::vector<std::string> referenceSources{"nlsr.conf", "readvertise", "prefix-update"};
+  const std::vector<std::string> sources = list.getSources(name1);
+  BOOST_REQUIRE_EQUAL(list.countSources(name1), 2);
+  for (const auto& source : sources) {
+    bool didMatch = false;
+    for (const auto& referenceSource : referenceSources) {
+      didMatch = didMatch || (source == referenceSource);
+    }
+    BOOST_CHECK(didMatch);
+  }
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index bb4db42..20856fe 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -150,10 +150,10 @@
   face.receive(*command);
   this->advanceClocks(ndn::time::milliseconds(10));
 
-  BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 1);
-  auto itr = std::find(namePrefixes.getNameList().begin(), namePrefixes.getNameList().end(),
-                       prefixName);
-  if (itr == namePrefixes.getNameList().end()) {
+  BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 1);
+  std::list<ndn::Name> names = namePrefixes.getNames();
+  auto itr = std::find(names.begin(), names.end(), prefixName);
+  if (itr == namePrefixes.getNames().end()) {
     BOOST_FAIL("Prefix was not inserted!");
   }
   BOOST_CHECK_EQUAL((*itr), prefixName);
@@ -167,7 +167,7 @@
   ndn::Name prefixName("/test/prefixA");
   ndn::nfd::ControlParameters parameters;
 
-  namePrefixes.getNameList().push_back(prefixName);
+  namePrefixes.insert(prefixName);
 
   shared_ptr<ndn::Interest> command = makeInterest(name.append(parameters.setName(prefixName)
     .wireEncode()), 0);
@@ -175,7 +175,7 @@
   face.receive(ndn::Interest(name));
   this->advanceClocks(ndn::time::milliseconds(10));
 
-  BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
+  BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
   BOOST_CHECK(wasRoutingUpdatePublished());
   BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
 }
@@ -192,7 +192,7 @@
   face.receive(ndn::Interest(name));
   this->advanceClocks(ndn::time::milliseconds(10));
 
-  BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
+  BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
 
   // Cannot use routingUpdatePublish test now since in
   // initialize nlsr calls buildOwnNameLsa which publishes the routing update
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 19deaf6..32cacb5 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -253,7 +253,7 @@
   NamePrefixList& namePrefixList = nlsr.getNamePrefixList();
 
   BOOST_REQUIRE_EQUAL(namePrefixList.getSize(), 1);
-  BOOST_CHECK_EQUAL(namePrefixList.getNameList().front(), parameters.getName());
+  BOOST_CHECK_EQUAL(namePrefixList.getNames().front(), parameters.getName());
 
   BOOST_CHECK(wasRoutingUpdatePublished());
   BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
