diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index ee3e0af..e490892 100644
--- a/tools/nfdc/forwarder-general-module.cpp
+++ b/tools/nfdc/forwarder-general-module.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -30,11 +30,6 @@
 namespace tools {
 namespace nfdc {
 
-ForwarderGeneralModule::ForwarderGeneralModule()
-  : m_nfdIdCollector(nullptr)
-{
-}
-
 void
 ForwarderGeneralModule::fetchStatus(Controller& controller,
                                     const function<void()>& onSuccess,
@@ -55,30 +50,17 @@
   return status.getCurrentTimestamp() - status.getStartTimestamp();
 }
 
-const Name&
-ForwarderGeneralModule::getNfdId() const
-{
-  if (m_nfdIdCollector != nullptr && m_nfdIdCollector->hasNfdId()) {
-    return m_nfdIdCollector->getNfdId();
-  }
-
-  static Name unavailable("/nfdId-unavailable");
-  return unavailable;
-}
-
 void
 ForwarderGeneralModule::formatStatusXml(std::ostream& os) const
 {
-  this->formatItemXml(os, m_status, this->getNfdId());
+  this->formatItemXml(os, m_status);
 }
 
 void
-ForwarderGeneralModule::formatItemXml(std::ostream& os, const ForwarderStatus& item,
-                                      const Name& nfdId) const
+ForwarderGeneralModule::formatItemXml(std::ostream& os, const ForwarderStatus& item) const
 {
   os << "<generalStatus>";
 
-  os << "<nfdId>" << nfdId << "</nfdId>";
   os << "<version>" << xml::Text{item.getNfdVersion()} << "</version>";
   os << "<startTime>" << xml::formatTimestamp(item.getStartTimestamp()) << "</startTime>";
   os << "<currentTime>" << xml::formatTimestamp(item.getCurrentTimestamp()) << "</currentTime>";
@@ -110,14 +92,12 @@
 ForwarderGeneralModule::formatStatusText(std::ostream& os) const
 {
   os << "General NFD status:\n";
-  this->formatItemText(os, m_status, this->getNfdId());
+  this->formatItemText(os, m_status);
 }
 
 void
-ForwarderGeneralModule::formatItemText(std::ostream& os, const ForwarderStatus& item,
-                                       const Name& nfdId) const
+ForwarderGeneralModule::formatItemText(std::ostream& os, const ForwarderStatus& item) const
 {
-  os << "                 nfdId=" << nfdId << "\n";
   os << "               version=" << item.getNfdVersion() << "\n";
   os << "             startTime=" << text::formatTimestamp(item.getStartTimestamp()) << "\n";
   os << "           currentTime=" << text::formatTimestamp(item.getCurrentTimestamp()) << "\n";
@@ -137,54 +117,6 @@
   os << "             nOutNacks=" << item.getNOutNacks() << "\n";
 }
 
-NfdIdCollector::NfdIdCollector(unique_ptr<ndn::Validator> inner)
-  : m_inner(std::move(inner))
-  , m_hasNfdId(false)
-{
-  BOOST_ASSERT(m_inner != nullptr);
-}
-
-const Name&
-NfdIdCollector::getNfdId() const
-{
-  if (!m_hasNfdId) {
-    BOOST_THROW_EXCEPTION(std::runtime_error("NfdId is unavailable"));
-  }
-
-  return m_nfdId;
-}
-
-void
-NfdIdCollector::checkPolicy(const Data& data, int nSteps,
-                            const ndn::OnDataValidated& accept,
-                            const ndn::OnDataValidationFailed& reject,
-                            std::vector<shared_ptr<ndn::ValidationRequest>>& nextSteps)
-{
-  ndn::OnDataValidated accepted = [this, accept] (const shared_ptr<const Data>& data) {
-    accept(data); // pass the Data to Validator user's validated callback
-
-    if (m_hasNfdId) {
-      return;
-    }
-
-    const ndn::Signature& sig = data->getSignature();
-    if (!sig.hasKeyLocator()) {
-      return;
-    }
-
-    const ndn::KeyLocator& kl = sig.getKeyLocator();
-    if (kl.getType() != ndn::KeyLocator::KeyLocator_Name) {
-      return;
-    }
-
-    m_nfdId = kl.getName();
-    m_hasNfdId = true;
-  };
-
-  BOOST_ASSERT(nSteps == 0);
-  m_inner->validate(data, accepted, reject);
-}
-
 } // namespace nfdc
 } // namespace tools
 } // namespace nfd
