diff --git a/daemon/table/cleanup.cpp b/daemon/table/cleanup.cpp
index 0ba0725..8317099 100644
--- a/daemon/table/cleanup.cpp
+++ b/daemon/table/cleanup.cpp
@@ -44,7 +44,7 @@
     }
 
     if (nte.getFibEntry() == nullptr && !nte.hasPitEntries()) {
-      maybeEmptyNtes.emplace(nte.getPrefix().size(), const_pointer_cast<name_tree::Entry>(nte.shared_from_this()));
+      maybeEmptyNtes.emplace(nte.getName().size(), const_pointer_cast<name_tree::Entry>(nte.shared_from_this()));
     }
   }
 
@@ -53,7 +53,7 @@
     shared_ptr<name_tree::Entry> nte = i->second.lock();
     // nte may have been erased when its last child is erased
     if (nte != nullptr) {
-      nt.eraseEntryIfEmpty(nte);
+      nt.eraseIfEmpty(nte.get());
     }
   }
 }
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 890bbbe..d18ce94 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -136,7 +136,7 @@
 
   nte->setFibEntry(nullptr);
   if (canDeleteNte) {
-    m_nameTree.eraseEntryIfEmpty(nte);
+    m_nameTree.eraseIfEmpty(nte.get());
   }
   --m_nItems;
 }
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index c939b72..d93cc91 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -45,7 +45,7 @@
     return *entry;
   }
 
-  nte.setMeasurementsEntry(make_unique<Entry>(nte.getPrefix()));
+  nte.setMeasurementsEntry(make_unique<Entry>(nte.getName()));
   ++m_nItems;
   entry = nte.getMeasurementsEntry();
 
@@ -165,7 +165,7 @@
   BOOST_ASSERT(nte != nullptr);
 
   nte->setMeasurementsEntry(nullptr);
-  m_nameTree.eraseEntryIfEmpty(nte);
+  m_nameTree.eraseIfEmpty(nte.get());
   --m_nItems;
 }
 
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index 9875891..576139c 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -48,13 +48,6 @@
     return m_name;
   }
 
-  /// \deprecated
-  const Name&
-  getPrefix() const
-  {
-    return this->getName();
-  }
-
   /** \return entry of getName().getPrefix(-1)
    *  \retval nullptr this entry is the root entry, i.e. getName() == Name()
    */
diff --git a/daemon/table/name-tree-iterator.cpp b/daemon/table/name-tree-iterator.cpp
index 9832dcd..e62060a 100644
--- a/daemon/table/name-tree-iterator.cpp
+++ b/daemon/table/name-tree-iterator.cpp
@@ -90,12 +90,12 @@
     return os << "uninitialized";
   }
 
-  os << "entry=" << i.m_entry->getPrefix();
+  os << "entry=" << i.m_entry->getName();
   if (i.m_ref == nullptr) {
     os << " ref=null";
   }
   else {
-    os << " ref=" << i.m_ref->getPrefix();
+    os << " ref=" << i.m_ref->getName();
   }
   os << " state=" << i.m_state;
   return os;
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index bbe5784..993a58a 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -77,12 +77,12 @@
     return nullptr;
   }
 
-  if (nte->getPrefix().size() == pitEntry.getName().size()) {
+  if (nte->getName().size() == pitEntry.getName().size()) {
     return nte;
   }
 
   BOOST_ASSERT(pitEntry.getName().at(-1).isImplicitSha256Digest());
-  BOOST_ASSERT(nte->getPrefix() == pitEntry.getName().getPrefix(-1));
+  BOOST_ASSERT(nte->getName() == pitEntry.getName().getPrefix(-1));
   return this->lookup(pitEntry.getName());
 }
 
@@ -103,7 +103,7 @@
 }
 
 size_t
-NameTree::eraseEntryIfEmpty(Entry* entry)
+NameTree::eraseIfEmpty(Entry* entry)
 {
   BOOST_ASSERT(entry != nullptr);
 
@@ -167,21 +167,20 @@
 {
   shared_ptr<Entry> nte = this->getEntry(pitEntry);
   BOOST_ASSERT(nte != nullptr);
-  if (nte->getPrefix().size() == pitEntry.getName().size()) {
+  if (nte->getName().size() == pitEntry.getName().size()) {
     return nte;
   }
 
   BOOST_ASSERT(pitEntry.getName().at(-1).isImplicitSha256Digest());
-  BOOST_ASSERT(nte->getPrefix() == pitEntry.getName().getPrefix(-1));
+  BOOST_ASSERT(nte->getName() == pitEntry.getName().getPrefix(-1));
   shared_ptr<Entry> exact = this->findExactMatch(pitEntry.getName());
   return exact == nullptr ? nte : exact;
 }
 
 boost::iterator_range<NameTree::const_iterator>
-NameTree::findAllMatches(const Name& prefix,
-                         const EntrySelector& entrySelector) const
+NameTree::findAllMatches(const Name& name, const EntrySelector& entrySelector) const
 {
-  NFD_LOG_TRACE("NameTree::findAllMatches" << prefix);
+  NFD_LOG_TRACE("NameTree::findAllMatches" << name);
 
   // As we are using Name Prefix Hash Table, and the current LPM() is
   // implemented as starting from full name, and reduce the number of
@@ -189,7 +188,7 @@
   // For trie-like design, it could be more efficient by walking down the
   // trie from the root node.
 
-  shared_ptr<Entry> entry = findLongestPrefixMatch(prefix, entrySelector);
+  shared_ptr<Entry> entry = findLongestPrefixMatch(name, entrySelector);
   return {Iterator(make_shared<PrefixMatchImpl>(*this, entrySelector), entry.get()), end()};
 }
 
diff --git a/daemon/table/name-tree.hpp b/daemon/table/name-tree.hpp
index ad9f314..d630cad 100644
--- a/daemon/table/name-tree.hpp
+++ b/daemon/table/name-tree.hpp
@@ -31,6 +31,8 @@
 namespace nfd {
 namespace name_tree {
 
+/** \brief a common index structure for FIB, PIT, StrategyChoice, and Measurements
+ */
 class NameTree : noncopyable
 {
 public:
@@ -40,7 +42,7 @@
   NameTree(size_t nBuckets = 1024);
 
 public: // information
-  /** \brief Get the number of occupied entries in the Name Tree
+  /** \return number of name tree entries
    */
   size_t
   size() const
@@ -48,10 +50,7 @@
     return m_ht.size();
   }
 
-  /** \brief Get the number of buckets in the Name Tree (NPHT)
-   *
-   *  The number of buckets is the one that used to create the hash
-   *  table, i.e., m_nBuckets.
+  /** \return number of hashtable buckets
    */
   size_t
   getNBuckets() const
@@ -59,7 +58,7 @@
     return m_ht.getNBuckets();
   }
 
-  /** \return Name Tree Entry on which a table entry is attached
+  /** \return entry on which a table entry is attached
    */
   template<typename ENTRY>
   shared_ptr<Entry>
@@ -69,149 +68,152 @@
   }
 
 public: // mutation
-  /** \brief Look for the Name Tree Entry that contains this name prefix.
-   *
-   *  Starts from the shortest name prefix, and then increase the
-   *  number of name components by one each time. All non-existing Name Tree
-   *  Entries will be created.
-   *
-   *  \param name The querying name prefix.
-   *  \return The pointer to the Name Tree Entry that contains this full name prefix.
+  /** \brief find or insert an entry with specified name
+   *  \param name a name prefix
+   *  \return an entry with \p name
+   *  \post an entry with \p name and all ancestors are created
    *  \note Existing iterators are unaffected.
    */
   shared_ptr<Entry>
   lookup(const Name& name);
 
-  /** \brief get NameTree entry from FIB entry
-   *
-   *  This is equivalent to .lookup(fibEntry.getPrefix())
+  /** \brief equivalent to .lookup(fibEntry.getPrefix())
+   *  \note This overload is more efficient than .lookup(const Name&) in common cases.
    */
   shared_ptr<Entry>
   lookup(const fib::Entry& fibEntry) const;
 
-  /** \brief get NameTree entry from PIT entry
-   *
-   *  This is equivalent to .lookup(pitEntry.getName()).
+  /** \brief equivalent to .lookup(pitEntry.getName()).
+   *  \note This overload is more efficient than .lookup(const Name&) in common cases.
    */
   shared_ptr<Entry>
   lookup(const pit::Entry& pitEntry);
 
-  /** \brief get NameTree entry from Measurements entry
-   *
-   *  This is equivalent to .lookup(measurementsEntry.getName())
+  /** \brief equivalent to .lookup(measurementsEntry.getName())
+   *  \note This overload is more efficient than .lookup(const Name&) in common cases.
    */
   shared_ptr<Entry>
   lookup(const measurements::Entry& measurementsEntry) const;
 
-  /** \brief get NameTree entry from StrategyChoice entry
-   *
-   *  This is equivalent to .lookup(strategyChoiceEntry.getName())
+  /** \brief equivalent to .lookup(strategyChoiceEntry.getName())
+   *  \note This overload is more efficient than .lookup(const Name&) in common cases.
    */
   shared_ptr<Entry>
   lookup(const strategy_choice::Entry& strategyChoiceEntry) const;
 
-  /** \brief Delete a Name Tree Entry if this entry is empty.
-   *  \param entry The entry to be deleted if empty.
-   *  \note This function must be called after a table entry is detached from Name Tree
-   *        entry. The function deletes a Name Tree entry if nothing is attached to it and
-   *        it has no children, then repeats the same process on its ancestors.
+  /** \brief delete the entry if it is empty
+   *  \param entry a valid entry
+   *  \return number of deleted entries
+   *  \sa Entry::isEmpty()
+   *  \post If the entry is empty, it's deleted.
+   *        Ancestors of the entry are also deleted if they become empty.
+   *  \note This function must be called after detaching a table entry from a name tree entry,
    *  \note Existing iterators, except those pointing to deleted entries, are unaffected.
    */
   size_t
-  eraseEntryIfEmpty(Entry* entry);
-
-  /// \deprecated
-  bool
-  eraseEntryIfEmpty(shared_ptr<Entry> entry)
-  {
-    BOOST_ASSERT(entry != nullptr);
-    return this->eraseEntryIfEmpty(entry.get()) > 0;
-  }
+  eraseIfEmpty(Entry* entry);
 
 public: // matching
-  /** \brief Exact match lookup for the given name prefix.
-   *  \return nullptr if this prefix is not found; otherwise return the Name Tree Entry address
+  /** \brief exact match lookup
+   *  \return entry with \p name, or nullptr if it does not exist
    */
   shared_ptr<Entry>
   findExactMatch(const Name& name) const;
 
-  /** \brief Longest prefix matching for the given name
-   *
-   *  Starts from the full name string, reduce the number of name component
-   *  by one each time, until an Entry is found.
+  /** \brief longest prefix matching
+   *  \return entry whose name is a prefix of \p name and passes \p entrySelector,
+   *          where no other entry with a longer name satisfies those requirements;
+   *          or nullptr if no entry satisfying those requirements exists
    */
   shared_ptr<Entry>
   findLongestPrefixMatch(const Name& name,
                          const EntrySelector& entrySelector = AnyEntry()) const;
 
+  /** \brief equivalent to .findLongestPrefixMatch(entry->getName(), entrySelector)
+   *  \note This overload is more efficient than .findLongestPrefixMatch(const Name&)
+   *        in common cases.
+   */
   shared_ptr<Entry>
   findLongestPrefixMatch(shared_ptr<Entry> entry,
                          const EntrySelector& entrySelector = AnyEntry()) const;
 
-  /** \brief longest prefix matching for Interest name of the PIT entry
-   *
-   *  This is equivalent to .findLongestPrefixMatch(pitEntry.getName(), AnyEntry()).
+  /** \brief equivalent to .findLongestPrefixMatch(pitEntry.getName(), AnyEntry())
+   *  \note This overload is more efficient than .findLongestPrefixMatch(const Name&)
+   *        in common cases.
    */
   shared_ptr<Entry>
   findLongestPrefixMatch(const pit::Entry& pitEntry) const;
 
-  /** \brief Enumerate all the name prefixes that satisfy the prefix and entrySelector
+  /** \brief all-prefixes match lookup
    *  \return an unspecified type that have .begin() and .end() methods
-   *          and is usable with range-based for
+   *          and is usable with range-based for.
+   *          Every entry in the range has a name that is a prefix of \p name ,
+   *          and matches \p entrySelector.
    *
    *  Example:
-   *  \code{.cpp}
-   *  auto&& allMatches = nt.findAllMatches(Name("/A/B/C"));
+   *  \code
+   *  Name name("/A/B/C");
+   *  auto&& allMatches = nt.findAllMatches(name);
    *  for (const Entry& nte : allMatches) {
+   *    BOOST_ASSERT(nte.getName().isPrefixOf(name));
    *    ...
    *  }
    *  \endcode
-   *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated when NameTree is modified
+   *  \note Iteration order is implementation-specific and is undefined.
+   *  \warning If a name tree entry whose name is a prefix of \p name is inserted
+   *           during the enumeration, it may or may not be visited.
+   *           If a name tree entry whose name is a prefix of \p name is deleted
+   *           during the enumeration, undefined behavior may occur.
    */
   boost::iterator_range<const_iterator>
-  findAllMatches(const Name& prefix,
+  findAllMatches(const Name& name,
                  const EntrySelector& entrySelector = AnyEntry()) const;
 
 public: // enumeration
-  /** \brief Enumerate all entries, optionally filtered by an EntrySelector.
+  /** \brief enumerate all entries
    *  \return an unspecified type that have .begin() and .end() methods
-   *          and is usable with range-based for
+   *          and is usable with range-based for.
+   *          Every entry in the range matches \p entrySelector.
    *
    *  Example:
-   *  \code{.cpp}
+   *  \code
    *  auto&& enumerable = nt.fullEnumerate();
    *  for (const Entry& nte : enumerable) {
    *    ...
    *  }
    *  \endcode
-   *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated when NameTree is modified
+   *  \note Iteration order is implementation-specific and is undefined.
+   *  \warning If a name tree entry is inserted or deleted during the enumeration,
+   *           it may cause the enumeration to skip entries or visit some entries twice.
    */
   boost::iterator_range<const_iterator>
   fullEnumerate(const EntrySelector& entrySelector = AnyEntry()) const;
 
-  /** \brief Enumerate all entries under a prefix, optionally filtered by an EntrySubTreeSelector.
+  /** \brief enumerate all entries under a prefix
    *  \return an unspecified type that have .begin() and .end() methods
-   *          and is usable with range-based for
+   *          and is usable with range-based for.
+   *          Every entry in the range has a name that starts with \p prefix,
+   *          and matches \p entrySubTreeSelector.
    *
    *  Example:
-   *  \code{.cpp}
-   *  auto&& enumerable = nt.partialEnumerate(Name("/A/B/C"));
+   *  \code
+   *  Name name("/A/B/C");
+   *  auto&& enumerable = nt.partialEnumerate(name);
    *  for (const Entry& nte : enumerable) {
+   *    BOOST_ASSERT(name.isPrefixOf(nte.getName()));
    *    ...
    *  }
    *  \endcode
-   *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated when NameTree is modified
+   *  \note Iteration order is implementation-specific and is undefined.
+   *  \warning If a name tree entry under \p prefix is inserted or deleted during the enumeration,
+   *           it may cause the enumeration to skip entries or visit some entries twice.
    */
   boost::iterator_range<const_iterator>
   partialEnumerate(const Name& prefix,
                    const EntrySubTreeSelector& entrySubTreeSelector = AnyEntrySubTree()) const;
 
-  /** \brief Get an iterator pointing to the first NameTree entry
-   *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated when NameTree is modified
+  /** \return an iterator to enumerate all entries
+   *  \sa fullEnumerate
    */
   const_iterator
   begin() const
@@ -219,9 +221,7 @@
     return fullEnumerate().begin();
   }
 
-  /** \brief Get an iterator referring to the past-the-end FIB entry
-   *  \note Iteration order is implementation-specific and is undefined
-   *  \note The returned iterator may get invalidated when NameTree is modified
+  /** \return a past-the-end iterator
    */
   const_iterator
   end() const
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 57cbf53..de6c9da 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -137,7 +137,7 @@
 
   nte->erasePitEntry(entry);
   if (canDeleteNte) {
-    m_nameTree.eraseEntryIfEmpty(nte);
+    m_nameTree.eraseIfEmpty(nte.get());
   }
   --m_nItems;
 }
diff --git a/daemon/table/strategy-choice.cpp b/daemon/table/strategy-choice.cpp
index 3c701d4..a8b32d7 100644
--- a/daemon/table/strategy-choice.cpp
+++ b/daemon/table/strategy-choice.cpp
@@ -145,7 +145,7 @@
   this->changeStrategy(*entry, oldStrategy, parentStrategy);
 
   nte->setStrategyChoiceEntry(nullptr);
-  m_nameTree.eraseEntryIfEmpty(nte);
+  m_nameTree.eraseIfEmpty(nte.get());
   --m_nItems;
 }
 
@@ -229,7 +229,7 @@
 static inline void
 clearStrategyInfo(const name_tree::Entry& nte)
 {
-  NFD_LOG_TRACE("clearStrategyInfo " << nte.getPrefix());
+  NFD_LOG_TRACE("clearStrategyInfo " << nte.getName());
 
   for (const shared_ptr<pit::Entry>& pitEntry : nte.getPitEntries()) {
     pitEntry->clearStrategyInfo();
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index f87b50f..4c030ac 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -187,7 +187,7 @@
 
   auto node = make_unique<Node>(0, prefix);
   shared_ptr<Entry> npe = node->entry;
-  BOOST_CHECK_EQUAL(npe->getPrefix(), prefix);
+  BOOST_CHECK_EQUAL(npe->getName(), prefix);
 
   // examine all the get methods
 
@@ -312,7 +312,7 @@
   bool eraseResult = false;
   temp = nt.findExactMatch(nameABC);
   if (temp != nullptr)
-    eraseResult = nt.eraseEntryIfEmpty(temp);
+    eraseResult = nt.eraseIfEmpty(temp.get());
   BOOST_CHECK_EQUAL(nt.size(), 6);
   BOOST_CHECK(nt.findExactMatch(nameABC) == nullptr);
   BOOST_CHECK_EQUAL(eraseResult, true);
@@ -320,20 +320,18 @@
   eraseResult = false;
   temp = nt.findExactMatch(nameABCLPM);
   if (temp != nullptr)
-    eraseResult = nt.eraseEntryIfEmpty(temp);
+    eraseResult = nt.eraseIfEmpty(temp.get());
   BOOST_CHECK(temp == nullptr);
   BOOST_CHECK_EQUAL(nt.size(), 6);
   BOOST_CHECK_EQUAL(eraseResult, false);
 
-  // nt.dump(std::cout);
-
   nt.lookup(nameABC);
   BOOST_CHECK_EQUAL(nt.size(), 7);
 
   eraseResult = false;
   temp = nt.findExactMatch(nameABC);
   if (temp != nullptr)
-    eraseResult = nt.eraseEntryIfEmpty(temp);
+    eraseResult = nt.eraseIfEmpty(temp.get());
   BOOST_CHECK_EQUAL(nt.size(), 6);
   BOOST_CHECK_EQUAL(eraseResult, true);
   BOOST_CHECK(nt.findExactMatch(nameABC) == nullptr);
@@ -350,22 +348,22 @@
 
   // try to erase /a/b/c, should return false
   temp = nt.findExactMatch(nameABC);
-  BOOST_CHECK_EQUAL(temp->getPrefix(), nameABC);
-  eraseResult = nt.eraseEntryIfEmpty(temp);
+  BOOST_CHECK_EQUAL(temp->getName(), nameABC);
+  eraseResult = nt.eraseIfEmpty(temp.get());
   BOOST_CHECK_EQUAL(eraseResult, false);
   temp = nt.findExactMatch(nameABC);
-  BOOST_CHECK_EQUAL(temp->getPrefix(), nameABC);
+  BOOST_CHECK_EQUAL(temp->getName(), nameABC);
 
   temp = nt.findExactMatch(nameABD);
   if (temp != nullptr)
-    nt.eraseEntryIfEmpty(temp);
+    nt.eraseIfEmpty(temp.get());
   BOOST_CHECK_EQUAL(nt.size(), 8);
 }
 
 /** \brief verify a NameTree enumeration contains expected entries
  *
  *  Example:
- *  \code{.cpp}
+ *  \code
  *  auto& enumerable = ...;
  *  EnumerationVerifier(enumerable)
  *    .expect("/A")
@@ -381,7 +379,7 @@
   EnumerationVerifier(Enumerable&& enumerable)
   {
     for (const Entry& entry : enumerable) {
-      const Name& name = entry.getPrefix();
+      const Name& name = entry.getName();
       BOOST_CHECK_MESSAGE(m_names.insert(name).second, "duplicate Name " << name);
     }
   }
@@ -497,7 +495,7 @@
 
   // Accept "root" nameA only
   auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) {
-    return std::make_pair(entry.getPrefix() == "/a", true);
+    return std::make_pair(entry.getName() == "/a", true);
   });
 
   EnumerationVerifier(enumerable)
@@ -511,7 +509,7 @@
 
   // Accept anything except "root" nameA
   auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) {
-    return std::make_pair(entry.getPrefix() != "/a", true);
+    return std::make_pair(entry.getName() != "/a", true);
   });
 
   EnumerationVerifier(enumerable)
@@ -527,7 +525,7 @@
   // No NameA
   // No SubTree from NameAB
   auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) {
-      return std::make_pair(entry.getPrefix() != "/a", entry.getPrefix() != "/a/b");
+      return std::make_pair(entry.getName() != "/a", entry.getName() != "/a/b");
     });
 
   EnumerationVerifier(enumerable)
@@ -545,7 +543,7 @@
   // No NameA
   // No SubTree from NameAC
   auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) {
-      return std::make_pair(entry.getPrefix() != "/a", entry.getPrefix() != "/a/c");
+      return std::make_pair(entry.getName() != "/a", entry.getName() != "/a/c");
     });
 
   EnumerationVerifier(enumerable)
@@ -562,7 +560,7 @@
 
   // No Subtree from NameA
   auto&& enumerable = nt.partialEnumerate("/a", [] (const Entry& entry) {
-      return std::make_pair(true, entry.getPrefix() != "/a");
+      return std::make_pair(true, entry.getName() != "/a");
     });
 
   EnumerationVerifier(enumerable)
@@ -593,7 +591,7 @@
       bool visitEntry = false;
       bool visitChildren = false;
 
-      Name name = entry.getPrefix();
+      Name name = entry.getName();
 
       if (name == "/" || name == "/A/B" || name == "/A/B/C" || name == "/A/D") {
         visitEntry = true;
@@ -645,7 +643,7 @@
   BOOST_CHECK_EQUAL(nameTree.size(), 9);
   BOOST_CHECK_EQUAL(nameTree.getNBuckets(), 32);
 
-  nameTree.eraseEntryIfEmpty(entry);
+  nameTree.eraseIfEmpty(entry.get());
   BOOST_CHECK_EQUAL(nameTree.size(), 0);
   BOOST_CHECK_EQUAL(nameTree.getNBuckets(), 16);
 }
@@ -660,8 +658,8 @@
   Name nameB("/A/B");
   std::set<Name> seenNames;
   for (NameTree::const_iterator it = nt.begin(); it != nt.end(); ++it) {
-    BOOST_CHECK(seenNames.insert(it->getPrefix()).second);
-    if (it->getPrefix() == nameB) {
+    BOOST_CHECK(seenNames.insert(it->getName()).second);
+    if (it->getName() == nameB) {
       nt.lookup("/D");
     }
   }
@@ -676,7 +674,7 @@
   BOOST_CHECK(seenNames.size() == 5);
 }
 
-// .eraseEntryIfEmpty should not invalidate iterator
+// .eraseIfEmpty should not invalidate iterator
 BOOST_AUTO_TEST_CASE(SurvivedIteratorAfterErase)
 {
   NameTree nt;
@@ -688,9 +686,9 @@
   Name nameD("/A/D");
   std::set<Name> seenNames;
   for (NameTree::const_iterator it = nt.begin(); it != nt.end(); ++it) {
-    BOOST_CHECK(seenNames.insert(it->getPrefix()).second);
-    if (it->getPrefix() == nameD) {
-      nt.eraseEntryIfEmpty(nt.findExactMatch("/A/F/G")); // /A/F/G and /A/F are erased
+    BOOST_CHECK(seenNames.insert(it->getName()).second);
+    if (it->getName() == nameD) {
+      nt.eraseIfEmpty(nt.findExactMatch("/A/F/G").get()); // /A/F/G and /A/F are erased
     }
   }
 
