diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index db8a192..204aaaa 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -126,7 +126,7 @@
   }
 
   shared_ptr<Face> face = this->getFace(mi.lastNexthop);
-  if (face == nullptr || !fibEntry.hasNextHop(face)) {
+  if (face == nullptr || !fibEntry.hasNextHop(*face)) {
     NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone");
     return false;
   }
@@ -140,7 +140,7 @@
   NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop <<
                 " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
 
-  this->sendInterest(pitEntry, face);
+  this->sendInterest(pitEntry, *face);
 
   // schedule RTO timeout
   shared_ptr<PitInfo> pi = pitEntry->getOrCreateStrategyInfo<PitInfo>();
@@ -171,11 +171,11 @@
                           std::unordered_set<FaceId> exceptFaces)
 {
   for (const fib::NextHop& nexthop : fibEntry.getNextHops()) {
-    shared_ptr<Face> face = nexthop.getFace();
-    if (exceptFaces.count(face->getId()) > 0) {
+    Face& face = nexthop.getFace();
+    if (exceptFaces.count(face.getId()) > 0) {
       continue;
     }
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face->getId() <<
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face.getId() <<
                   " multicast");
     this->sendInterest(pitEntry, face);
   }
diff --git a/daemon/fw/asf-probing-module.cpp b/daemon/fw/asf-probing-module.cpp
index f561b52..097a372 100644
--- a/daemon/fw/asf-probing-module.cpp
+++ b/daemon/fw/asf-probing-module.cpp
@@ -64,7 +64,7 @@
   });
 }
 
-shared_ptr<Face>
+Face*
 ProbingModule::getFaceToProbe(const Face& inFace,
                               const Interest& interest,
                               const fib::Entry& fibEntry,
@@ -84,23 +84,23 @@
   // Put eligible faces into rankedFaces. If a face does not have an RTT measurement,
   // immediately pick the face for probing
   for (const fib::NextHop& hop : fibEntry.getNextHops()) {
-    const shared_ptr<Face>& hopFace = hop.getFace();
+    Face& hopFace = hop.getFace();
 
     // Don't send probe Interest back to the incoming face or use the same face
     // as the forwarded Interest
-    if (hopFace->getId() == inFace.getId() || hopFace->getId() == faceUsed.getId()) {
+    if (hopFace.getId() == inFace.getId() || hopFace.getId() == faceUsed.getId()) {
       continue;
     }
 
-    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
 
     // If no RTT has been recorded, probe this face
     if (info == nullptr || !info->hasSrttMeasurement()) {
-      return hopFace;
+      return &hopFace;
     }
 
     // Add FaceInfo to container sorted by RTT
-    rankedFaces.insert(std::make_pair(info, hopFace));
+    rankedFaces.insert(std::make_pair(info, &hopFace));
   }
 
   if (rankedFaces.empty()) {
@@ -140,7 +140,7 @@
   scheduleProbe(fibEntry, m_probingInterval);
 }
 
-shared_ptr<Face>
+Face*
 ProbingModule::getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces)
 {
   double randomNumber = getRandomNumber(0, 1);
diff --git a/daemon/fw/asf-probing-module.hpp b/daemon/fw/asf-probing-module.hpp
index 585b76a..3a4df6e 100644
--- a/daemon/fw/asf-probing-module.hpp
+++ b/daemon/fw/asf-probing-module.hpp
@@ -43,7 +43,7 @@
   void
   scheduleProbe(const fib::Entry& fibEntry, const time::milliseconds& interval);
 
-  shared_ptr<Face>
+  Face*
   getFaceToProbe(const Face& inFace,
                  const Interest& interest,
                  const fib::Entry& fibEntry,
@@ -57,11 +57,11 @@
 
 private:
   // Used to associate FaceInfo with the face in a NextHop
-  typedef std::pair<FaceInfo*, shared_ptr<Face>> FaceInfoFacePair;
+  typedef std::pair<FaceInfo*, Face*> FaceInfoFacePair;
   typedef std::function<bool(FaceInfoFacePair, FaceInfoFacePair)> FaceInfoPredicate;
   typedef std::set<FaceInfoFacePair, FaceInfoPredicate> FaceInfoFacePairSet;
 
-  shared_ptr<Face>
+  Face*
   getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces);
 
   double
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index cf616e8..3f8abf7 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -79,7 +79,7 @@
     return;
   }
 
-  const shared_ptr<Face> faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
+  Face* faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
 
   if (faceToUse == nullptr) {
     sendNoRouteNack(inFace, interest, pitEntry);
@@ -87,18 +87,18 @@
     return;
   }
 
-  forwardInterest(interest, fibEntry, pitEntry, faceToUse);
+  forwardInterest(interest, fibEntry, pitEntry, *faceToUse);
 
   // If necessary, send probe
   if (m_probing.isProbingNeeded(fibEntry, interest)) {
-    shared_ptr<Face> faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
+    Face* faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
 
     if (faceToProbe != nullptr) {
       NFD_LOG_TRACE("Sending probe for " << fibEntry.getPrefix()
                                          << " to FaceId: " << faceToProbe->getId());
 
       bool wantNewNonce = true;
-      forwardInterest(interest, fibEntry, pitEntry, faceToProbe, wantNewNonce);
+      forwardInterest(interest, fibEntry, pitEntry, *faceToProbe, wantNewNonce);
       m_probing.afterForwardingProbe(fibEntry, interest);
     }
   }
@@ -143,27 +143,27 @@
 AsfStrategy::forwardInterest(const Interest& interest,
                              const fib::Entry& fibEntry,
                              shared_ptr<pit::Entry> pitEntry,
-                             shared_ptr<Face> outFace,
+                             Face& outFace,
                              bool wantNewNonce)
 {
   this->sendInterest(pitEntry, outFace, wantNewNonce);
 
-  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, *outFace);
+  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, outFace);
 
   // Refresh measurements since Face is being used for forwarding
   NamespaceInfo& namespaceInfo = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
-  namespaceInfo.extendFaceInfoLifetime(faceInfo, *outFace);
+  namespaceInfo.extendFaceInfoLifetime(faceInfo, outFace);
 
   if (!faceInfo.isTimeoutScheduled()) {
     // Estimate and schedule timeout
     RttEstimator::Duration timeout = faceInfo.computeRto();
 
     NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix()
-                                            << " FaceId: " << outFace->getId()
+                                            << " FaceId: " << outFace.getId()
                                             << " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
 
     scheduler::EventId id = scheduler::schedule(timeout,
-        bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace->getId()));
+        bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace.getId()));
 
     faceInfo.setTimeoutEvent(id, interest.getName());
   }
@@ -171,7 +171,7 @@
 
 struct FaceStats
 {
-  shared_ptr<Face> face;
+  Face* face;
   RttStats::Rtt rtt;
   RttStats::Rtt srtt;
   uint64_t cost;
@@ -196,7 +196,7 @@
   }
 }
 
-const shared_ptr<Face>
+Face*
 AsfStrategy::getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace)
 {
   NFD_LOG_TRACE("Looking for best face for " << fibEntry.getPrefix());
@@ -222,17 +222,16 @@
   });
 
   for (const fib::NextHop& hop : fibEntry.getNextHops()) {
+    Face& hopFace = hop.getFace();
 
-    const shared_ptr<Face>& hopFace = hop.getFace();
-
-    if (hopFace->getId() == inFace.getId()) {
+    if (hopFace.getId() == inFace.getId()) {
       continue;
     }
 
-    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
 
     if (info == nullptr) {
-      FaceStats stats = {hopFace,
+      FaceStats stats = {&hopFace,
                          RttStats::RTT_NO_MEASUREMENT,
                          RttStats::RTT_NO_MEASUREMENT,
                          hop.getCost()};
@@ -240,7 +239,7 @@
       rankedFaces.insert(stats);
     }
     else {
-      FaceStats stats = {hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
+      FaceStats stats = {&hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
       rankedFaces.insert(stats);
     }
   }
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index cb50e01..ad00a3d 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -69,10 +69,10 @@
   forwardInterest(const Interest& interest,
                   const fib::Entry& fibEntry,
                   shared_ptr<pit::Entry> pitEntry,
-                  shared_ptr<Face> outFace,
+                  Face& outFace,
                   bool wantNewNonce = false);
 
-  const shared_ptr<Face>
+  Face*
   getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace);
 
   void
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index bae5262..b97afca 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -54,14 +54,14 @@
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
   fib::NextHopList::const_iterator it = std::find_if(nexthops.begin(), nexthops.end(),
-    [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, *nexthop.getFace()); });
+    [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, nexthop.getFace()); });
 
   if (it == nexthops.end()) {
     this->rejectPendingInterest(pitEntry);
     return;
   }
 
-  shared_ptr<Face> outFace = it->getFace();
+  Face& outFace = it->getFace();
   this->sendInterest(pitEntry, outFace);
 }
 
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index ef68175..df6ca4d 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -59,19 +59,19 @@
   bool wantUnused = false,
   time::steady_clock::TimePoint now = time::steady_clock::TimePoint::min())
 {
-  shared_ptr<Face> upstream = nexthop.getFace();
+  Face& upstream = nexthop.getFace();
 
   // upstream is current downstream
-  if (upstream->getId() == currentDownstream)
+  if (upstream.getId() == currentDownstream)
     return false;
 
   // forwarding would violate scope
-  if (violatesScope(*pitEntry, *upstream))
+  if (violatesScope(*pitEntry, upstream))
     return false;
 
   if (wantUnused) {
     // NextHop must not have unexpired out-record
-    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*upstream);
+    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(upstream);
     if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
       return false;
     }
@@ -93,7 +93,7 @@
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
     if (!predicate_NextHop_eligible(pitEntry, *it, currentDownstream))
       continue;
-    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*it->getFace());
+    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(it->getFace());
     BOOST_ASSERT(outRecord != pitEntry->out_end());
     if (outRecord->getLastRenewed() < earliestRenewed) {
       found = it;
@@ -136,10 +136,10 @@
       return;
     }
 
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " newPitEntry-to=" << outFace->getId());
+                           << " newPitEntry-to=" << outFace.getId());
     return;
   }
 
@@ -148,10 +148,10 @@
                     bind(&predicate_NextHop_eligible, pitEntry, _1, inFace.getId(),
                          true, time::steady_clock::now()));
   if (it != nexthops.end()) {
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-unused-to=" << outFace->getId());
+                           << " retransmit-unused-to=" << outFace.getId());
     return;
   }
 
@@ -161,10 +161,10 @@
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " retransmitNoNextHop");
   }
   else {
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-retry-to=" << outFace->getId());
+                           << " retransmit-retry-to=" << outFace.getId());
   }
 }
 
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index 8c6a778..d78baf6 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -56,10 +56,12 @@
 
   virtual void
   afterReceiveInterest(const Face& inFace, const Interest& interest,
+
                        shared_ptr<pit::Entry> pitEntry) override;
 
   virtual void
   afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+
                    shared_ptr<pit::Entry> pitEntry) override;
 
 public:
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index 044e065..a73291b 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -66,7 +66,7 @@
     return;
   }
 
-  this->sendInterest(pitEntry, outFace);
+  this->sendInterest(pitEntry, *outFace);
 }
 
 } // namespace fw
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index b4bda23..4cda948 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -108,7 +108,7 @@
                " remote=" << face->getRemoteUri() <<
                " local=" << face->getLocalUri());
 
-  m_forwarder.getFib().removeNextHopFromAllEntries(face);
+  m_forwarder.getFib().removeNextHopFromAllEntries(*face);
 
   // defer Face deallocation, so that Transport isn't deallocated during afterStateChange signal
   getGlobalIoService().post([face] {});
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3bb580d..0b4c653 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -522,7 +522,7 @@
   // has Link object?
   if (!interest.hasLink()) {
     // FIB lookup with Interest name
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
     NFD_LOG_TRACE("lookupFib noLinkObject found=" << fibEntry.getPrefix());
     return fibEntry;
   }
@@ -532,7 +532,7 @@
   // in producer region?
   if (m_networkRegionTable.isInProducerRegion(link)) {
     // FIB lookup with Interest name
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
     NFD_LOG_TRACE("lookupFib inProducerRegion found=" << fibEntry.getPrefix());
     return fibEntry;
   }
@@ -541,13 +541,13 @@
   if (interest.hasSelectedDelegation()) {
     // FIB lookup with SelectedDelegation
     Name selectedDelegation = interest.getSelectedDelegation();
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(selectedDelegation);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(selectedDelegation);
     NFD_LOG_TRACE("lookupFib hasSelectedDelegation=" << selectedDelegation << " found=" << fibEntry.getPrefix());
     return fibEntry;
   }
 
   // FIB lookup with first delegation Name
-  const fib::Entry& fibEntry0 = *m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
+  const fib::Entry& fibEntry0 = m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
   // in default-free zone?
   bool isDefaultFreeZone = !(fibEntry0.getPrefix().size() == 0 && fibEntry0.hasNextHops());
   if (!isDefaultFreeZone) {
@@ -558,7 +558,7 @@
   // choose and set SelectedDelegation
   for (const std::pair<uint32_t, Name>& delegation : link.getDelegations()) {
     const Name& delegationName = delegation.second;
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(delegationName);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(delegationName);
     if (fibEntry.hasNextHops()) {
       /// \todo Don't modify in-record Interests.
       ///       Set SelectedDelegation in outgoing Interest pipeline.
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 9b89049..5373d03 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -46,8 +46,8 @@
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
-    shared_ptr<Face> outFace = it->getFace();
-    if (canForwardToLegacy(*pitEntry, *outFace)) {
+    Face& outFace = it->getFace();
+    if (canForwardToLegacy(*pitEntry, outFace)) {
       this->sendInterest(pitEntry, outFace);
     }
   }
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index a459552..fc9cd20 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -74,13 +74,13 @@
   size_t nUpstreams = nexthops.size();
 
   shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
-  if (bestFace != nullptr && fibEntry.hasNextHop(bestFace) &&
+  if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace) &&
       canForwardToLegacy(*pitEntry, *bestFace)) {
     // TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
     deferFirst = measurementsEntryInfo->prediction;
     deferRange = time::microseconds((deferFirst.count() + 1) / 2);
     --nUpstreams;
-    this->sendInterest(pitEntry, bestFace);
+    this->sendInterest(pitEntry, *bestFace);
     pitEntryInfo->bestFaceTimeout = scheduler::schedule(
       measurementsEntryInfo->prediction,
       bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
@@ -89,7 +89,7 @@
     // use first eligible nexthop
     auto firstEligibleNexthop = std::find_if(nexthops.begin(), nexthops.end(),
         [&pitEntry] (const fib::NextHop& nexthop) {
-          return canForwardToLegacy(*pitEntry, *nexthop.getFace());
+          return canForwardToLegacy(*pitEntry, nexthop.getFace());
         });
     if (firstEligibleNexthop != nexthops.end()) {
       this->sendInterest(pitEntry, firstEligibleNexthop->getFace());
@@ -97,7 +97,7 @@
   }
 
   shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
-  if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+  if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
     --nUpstreams;
   }
@@ -135,16 +135,16 @@
     this->getMeasurementsEntryInfo(pitEntry);
 
   shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
-  if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+  if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
-    this->sendInterest(pitEntry, previousFace);
+    this->sendInterest(pitEntry, *previousFace);
   }
 
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
   bool isForwarded = false;
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
-    shared_ptr<Face> face = it->getFace();
-    if (canForwardToLegacy(*pitEntry, *face)) {
+    Face& face = it->getFace();
+    if (canForwardToLegacy(*pitEntry, face)) {
       isForwarded = true;
       this->sendInterest(pitEntry, face);
       break;
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 3a11568..386dd7f 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -130,7 +130,7 @@
    *                      rather than reusing a Nonce from one of the PIT in-records
    */
   VIRTUAL_WITH_TESTS void
-  sendInterest(shared_ptr<pit::Entry> pitEntry, shared_ptr<Face> outFace,
+  sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace,
                bool wantNewNonce = false);
 
   /** \brief decide that a pending Interest cannot be forwarded
@@ -200,11 +200,9 @@
 }
 
 inline void
-Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry,
-                       shared_ptr<Face> outFace,
-                       bool wantNewNonce)
+Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace, bool wantNewNonce)
 {
-  m_forwarder.onOutgoingInterest(pitEntry, *outFace, wantNewNonce);
+  m_forwarder.onOutgoingInterest(pitEntry, outFace, wantNewNonce);
 }
 
 inline void
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 09e184a..b7ac209 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -61,11 +61,10 @@
                 << " faceid: " << faceId
                 << " cost: " << cost);
 
-  auto face = m_getFace(faceId);
-  if (static_cast<bool>(face)) {
-    auto entry = m_fib.insert(prefix).first;
-
-    entry->addNextHop(face, cost);
+  shared_ptr<Face> face = m_getFace(faceId);
+  if (face != nullptr) {
+    fib::Entry* entry = m_fib.insert(prefix).first;
+    entry->addNextHop(*face, cost);
 
     NFD_LOG_DEBUG("add-nexthop result: OK"
                   << " prefix:" << prefix
@@ -90,11 +89,11 @@
   NFD_LOG_TRACE("remove-nexthop prefix: " << parameters.getName()
                 << " faceid: " << parameters.getFaceId());
 
-  auto face = m_getFace(parameters.getFaceId());
-  if (static_cast<bool>(face)) {
-    auto entry = m_fib.findExactMatch(parameters.getName());
-    if (static_cast<bool>(entry)) {
-      entry->removeNextHop(face);
+  shared_ptr<Face> face = m_getFace(parameters.getFaceId());
+  if (face != nullptr) {
+    fib::Entry* entry = m_fib.findExactMatch(parameters.getName());
+    if (entry != nullptr) {
+      entry->removeNextHop(*face);
       NFD_LOG_DEBUG("remove-nexthop result: OK prefix: " << parameters.getName()
                     << " faceid: " << parameters.getFaceId());
 
@@ -124,7 +123,7 @@
 
     for (auto&& next : nextHops) {
       ndn::nfd::NextHopRecord nextHopRecord;
-      nextHopRecord.setFaceId(next.getFace()->getId());
+      nextHopRecord.setFaceId(next.getFace().getId());
       nextHopRecord.setCost(next.getCost());
 
       record.addNextHopRecord(nextHopRecord);
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 5d9ce22..65fa80a 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -194,8 +194,7 @@
 
   // add FIB entry for NFD Management Protocol
   Name topPrefix("/localhost/nfd");
-  auto entry = m_forwarder->getFib().insert(topPrefix).first;
-  entry->addNextHop(m_internalFace, 0);
+  m_forwarder->getFib().insert(topPrefix).first->addNextHop(*m_internalFace, 0);
   m_dispatcher->addTopPrefix(topPrefix, false);
 }
 
diff --git a/daemon/table/fib-entry.cpp b/daemon/table/fib-entry.cpp
index b2ea76c..cb37b0f 100644
--- a/daemon/table/fib-entry.cpp
+++ b/daemon/table/fib-entry.cpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -34,40 +34,37 @@
 }
 
 NextHopList::iterator
-Entry::findNextHop(Face& face)
+Entry::findNextHop(const Face& face)
 {
   return std::find_if(m_nextHops.begin(), m_nextHops.end(),
                       [&face] (const NextHop& nexthop) {
-                        return nexthop.getFace().get() == &face;
+                        return &nexthop.getFace() == &face;
                       });
 }
 
 bool
-Entry::hasNextHop(shared_ptr<Face> face) const
+Entry::hasNextHop(const Face& face) const
 {
-  return const_cast<Entry*>(this)->findNextHop(*face) != m_nextHops.end();
+  return const_cast<Entry*>(this)->findNextHop(face) != m_nextHops.end();
 }
 
 void
-Entry::addNextHop(shared_ptr<Face> face, uint64_t cost)
+Entry::addNextHop(Face& face, uint64_t cost)
 {
-  auto it = this->findNextHop(*face);
+  auto it = this->findNextHop(face);
   if (it == m_nextHops.end()) {
-    m_nextHops.push_back(fib::NextHop(face));
-    it = m_nextHops.end();
-    --it;
+    m_nextHops.emplace_back(face);
+    it = std::prev(m_nextHops.end());
   }
-  // now it refers to the NextHop for face
 
   it->setCost(cost);
-
   this->sortNextHops();
 }
 
 void
-Entry::removeNextHop(shared_ptr<Face> face)
+Entry::removeNextHop(const Face& face)
 {
-  auto it = this->findNextHop(*face);
+  auto it = this->findNextHop(face);
   if (it != m_nextHops.end()) {
     m_nextHops.erase(it);
   }
diff --git a/daemon/table/fib-entry.hpp b/daemon/table/fib-entry.hpp
index 9106d9f..8f83266 100644
--- a/daemon/table/fib-entry.hpp
+++ b/daemon/table/fib-entry.hpp
@@ -67,37 +67,33 @@
   bool
   hasNextHops() const;
 
-  /** \return whether there is a NextHop record for face
-   *
-   *  \todo change parameter type to Face&
+  /** \return whether there is a NextHop record for \p face
    */
   bool
-  hasNextHop(shared_ptr<Face> face) const;
+  hasNextHop(const Face& face) const;
 
   /** \brief adds a NextHop record
    *
-   *  If a NextHop record for face already exists, its cost is updated.
-   *  \note shared_ptr is passed by value because this function will take shared ownership
+   *  If a NextHop record for \p face already exists, its cost is updated.
    */
   void
-  addNextHop(shared_ptr<Face> face, uint64_t cost);
+  addNextHop(Face& face, uint64_t cost);
 
   /** \brief removes a NextHop record
    *
    *  If no NextHop record for face exists, do nothing.
-   *
-   *  \todo change parameter type to Face&
    */
   void
-  removeNextHop(shared_ptr<Face> face);
+  removeNextHop(const Face& face);
 
 private:
-  /** @note This method is non-const because normal iterator is needed by callers.
+  /** \note This method is non-const because mutable iterators are needed by callers.
    */
   NextHopList::iterator
-  findNextHop(Face& face);
+  findNextHop(const Face& face);
 
-  /// sorts the nexthop list
+  /** \brief sorts the nexthop list
+   */
   void
   sortNextHops();
 
diff --git a/daemon/table/fib-nexthop.cpp b/daemon/table/fib-nexthop.cpp
index 235fc79..e554362 100644
--- a/daemon/table/fib-nexthop.cpp
+++ b/daemon/table/fib-nexthop.cpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -28,29 +28,11 @@
 namespace nfd {
 namespace fib {
 
-NextHop::NextHop(shared_ptr<Face> face)
-  : m_face(face)
+NextHop::NextHop(Face& face)
+  : m_face(&face)
   , m_cost(0)
 {
 }
 
-const shared_ptr<Face>&
-NextHop::getFace() const
-{
-  return m_face;
-}
-
-void
-NextHop::setCost(uint64_t cost)
-{
-  m_cost = cost;
-}
-
-uint64_t
-NextHop::getCost() const
-{
-  return m_cost;
-}
-
 } // namespace fib
 } // namespace nfd
diff --git a/daemon/table/fib-nexthop.hpp b/daemon/table/fib-nexthop.hpp
index 9f7ed93..c8c006e 100644
--- a/daemon/table/fib-nexthop.hpp
+++ b/daemon/table/fib-nexthop.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -39,19 +39,28 @@
 {
 public:
   explicit
-  NextHop(shared_ptr<Face> face);
+  NextHop(Face& face);
 
-  const shared_ptr<Face>&
-  getFace() const;
-
-  void
-  setCost(uint64_t cost);
+  Face&
+  getFace() const
+  {
+    return *m_face;
+  }
 
   uint64_t
-  getCost() const;
+  getCost() const
+  {
+    return m_cost;
+  }
+
+  void
+  setCost(uint64_t cost)
+  {
+    m_cost = cost;
+  }
 
 private:
-  shared_ptr<Face> m_face;
+  Face* m_face;
   uint64_t m_cost;
 };
 
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 946652e..2df3122 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -32,8 +32,9 @@
 #include <type_traits>
 
 namespace nfd {
+namespace fib {
 
-const shared_ptr<fib::Entry> Fib::s_emptyEntry = make_shared<fib::Entry>(Name());
+const unique_ptr<Entry> Fib::s_emptyEntry = make_unique<Entry>(Name());
 
 // http://en.cppreference.com/w/cpp/concept/ForwardIterator
 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Fib::const_iterator>));
@@ -57,39 +58,38 @@
 }
 
 static inline bool
-predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry& entry)
+predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry& nte)
 {
-  return entry.getFibEntry() != nullptr;
+  return nte.getFibEntry() != nullptr;
 }
 
-shared_ptr<fib::Entry>
+const Entry&
 Fib::findLongestPrefixMatch(const Name& prefix) const
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry =
+  shared_ptr<name_tree::Entry> nte =
     m_nameTree.findLongestPrefixMatch(prefix, &predicate_NameTreeEntry_hasFibEntry);
-  if (nameTreeEntry != nullptr) {
-    return nameTreeEntry->getFibEntry();
+  if (nte != nullptr) {
+    return *nte->getFibEntry();
   }
-  return s_emptyEntry;
+  return *s_emptyEntry;
 }
 
-shared_ptr<fib::Entry>
-Fib::findLongestPrefixMatch(shared_ptr<name_tree::Entry> nameTreeEntry) const
+const Entry&
+Fib::findLongestPrefixMatch(shared_ptr<name_tree::Entry> nte) const
 {
-  shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
+  Entry* entry = nte->getFibEntry();
   if (entry != nullptr)
-    return entry;
+    return *entry;
 
-  nameTreeEntry = m_nameTree.findLongestPrefixMatch(nameTreeEntry,
-                                                    &predicate_NameTreeEntry_hasFibEntry);
-  if (nameTreeEntry != nullptr) {
-    return nameTreeEntry->getFibEntry();
+  nte = m_nameTree.findLongestPrefixMatch(nte, &predicate_NameTreeEntry_hasFibEntry);
+  if (nte != nullptr) {
+    return *nte->getFibEntry();
   }
 
-  return s_emptyEntry;
+  return *s_emptyEntry;
 }
 
-shared_ptr<fib::Entry>
+const Entry&
 Fib::findLongestPrefixMatch(const pit::Entry& pitEntry) const
 {
   shared_ptr<name_tree::Entry> nte = m_nameTree.findLongestPrefixMatch(pitEntry);
@@ -97,82 +97,81 @@
   return findLongestPrefixMatch(nte);
 }
 
-shared_ptr<fib::Entry>
+const Entry&
 Fib::findLongestPrefixMatch(const measurements::Entry& measurementsEntry) const
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(measurementsEntry);
-  BOOST_ASSERT(nameTreeEntry != nullptr);
-
-  return findLongestPrefixMatch(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(measurementsEntry);
+  BOOST_ASSERT(nte != nullptr);
+  return findLongestPrefixMatch(nte);
 }
 
-shared_ptr<fib::Entry>
-Fib::findExactMatch(const Name& prefix) const
+Entry*
+Fib::findExactMatch(const Name& prefix)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
-  if (nameTreeEntry != nullptr)
-    return nameTreeEntry->getFibEntry();
+  shared_ptr<name_tree::Entry> nte = m_nameTree.findExactMatch(prefix);
+  if (nte != nullptr)
+    return nte->getFibEntry();
 
   return nullptr;
 }
 
-std::pair<shared_ptr<fib::Entry>, bool>
+std::pair<Entry*, bool>
 Fib::insert(const Name& prefix)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(prefix);
-  shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
-  if (entry != nullptr)
+  shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(prefix);
+  Entry* entry = nte->getFibEntry();
+  if (entry != nullptr) {
     return std::make_pair(entry, false);
+  }
 
-  entry = make_shared<fib::Entry>(prefix);
-  nameTreeEntry->setFibEntry(entry);
+  nte->setFibEntry(make_unique<Entry>(prefix));
   ++m_nItems;
-  return std::make_pair(entry, true);
+  return std::make_pair(nte->getFibEntry(), true);
 }
 
 void
-Fib::erase(shared_ptr<name_tree::Entry> nameTreeEntry)
+Fib::erase(shared_ptr<name_tree::Entry> nte)
 {
-  nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
-  m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
+  nte->setFibEntry(nullptr);
+  m_nameTree.eraseEntryIfEmpty(nte);
   --m_nItems;
 }
 
 void
 Fib::erase(const Name& prefix)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
-  if (nameTreeEntry != nullptr) {
-    this->erase(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.findExactMatch(prefix);
+  if (nte != nullptr) {
+    this->erase(nte);
   }
 }
 
 void
-Fib::erase(const fib::Entry& entry)
+Fib::erase(const Entry& entry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.lookup(entry);
-  if (nameTreeEntry != nullptr) {
-    this->erase(nameTreeEntry);
+  shared_ptr<name_tree::Entry> nte = m_nameTree.lookup(entry);
+  if (nte != nullptr) {
+    this->erase(nte);
   }
 }
 
 void
-Fib::removeNextHopFromAllEntries(shared_ptr<Face> face)
+Fib::removeNextHopFromAllEntries(const Face& face)
 {
-  std::list<fib::Entry*> toErase;
+  std::list<Entry*> toErase;
 
   auto&& enumerable = m_nameTree.fullEnumerate(&predicate_NameTreeEntry_hasFibEntry);
   for (const name_tree::Entry& nte : enumerable) {
-    shared_ptr<fib::Entry> entry = nte.getFibEntry();
+    Entry* entry = nte.getFibEntry();
     entry->removeNextHop(face);
     if (!entry->hasNextHops()) {
-      toErase.push_back(entry.get());
+      toErase.push_back(entry);
       // entry needs to be erased, but we must wait until the enumeration ends,
       // because otherwise NameTree iterator would be invalidated
     }
   }
 
-  for (fib::Entry* entry : toErase) {
+  for (Entry* entry : toErase) {
     this->erase(*entry);
   }
 }
@@ -183,4 +182,5 @@
   return const_iterator(m_nameTree.fullEnumerate(&predicate_NameTreeEntry_hasFibEntry).begin());
 }
 
+} // namespace fib
 } // namespace nfd
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index bde7428..bfe6684 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -33,13 +33,14 @@
 
 namespace measurements {
 class Entry;
-}
+} // namespace measurements
 namespace pit {
 class Entry;
-}
+} // namespace pit
 
-/** \class Fib
- *  \brief represents the FIB
+namespace fib {
+
+/** \brief represents the Forwarding Information Base (FIB)
  */
 class Fib : noncopyable
 {
@@ -53,44 +54,54 @@
   size() const;
 
 public: // lookup
-  /// performs a longest prefix match
-  shared_ptr<fib::Entry>
+  /** \brief performs a longest prefix match
+   */
+  const Entry&
   findLongestPrefixMatch(const Name& prefix) const;
 
-  /// performs a longest prefix match
-  shared_ptr<fib::Entry>
+  /** \brief performs a longest prefix match
+   *
+   *  This is equivalent to .findLongestPrefixMatch(pitEntry.getName())
+   */
+  const Entry&
   findLongestPrefixMatch(const pit::Entry& pitEntry) const;
 
-  /// performs a longest prefix match
-  shared_ptr<fib::Entry>
+  /** \brief performs a longest prefix match
+   *
+   *  This is equivalent to .findLongestPrefixMatch(measurementsEntry.getName())
+   */
+  const Entry&
   findLongestPrefixMatch(const measurements::Entry& measurementsEntry) const;
 
-  shared_ptr<fib::Entry>
-  findExactMatch(const Name& prefix) const;
+  /** \brief performs an exact match lookup
+   */
+  Entry*
+  findExactMatch(const Name& prefix);
 
 public: // mutation
   /** \brief inserts a FIB entry for prefix
+   *
    *  If an entry for exact same prefix exists, that entry is returned.
-   *  \return{ the entry, and true for new entry, false for existing entry }
+   *  \return the entry, and true for new entry or false for existing entry
    */
-  std::pair<shared_ptr<fib::Entry>, bool>
+  std::pair<Entry*, bool>
   insert(const Name& prefix);
 
   void
   erase(const Name& prefix);
 
   void
-  erase(const fib::Entry& entry);
+  erase(const Entry& entry);
 
-  /** \brief removes the NextHop record for face in all entrites
+  /** \brief removes the NextHop record for face in all entries
    *
-   *  This is usually invoked when face goes away.
+   *  This is usually invoked when face is destroyed.
    *  Removing the last NextHop in a FIB entry will erase the FIB entry.
    *
    *  \todo change parameter type to Face&
    */
   void
-  removeNextHopFromAllEntries(shared_ptr<Face> face);
+  removeNextHopFromAllEntries(const Face& face);
 
 public: // enumeration
   class const_iterator;
@@ -110,7 +121,7 @@
   const_iterator
   end() const;
 
-  class const_iterator : public std::iterator<std::forward_iterator_tag, const fib::Entry>
+  class const_iterator : public std::iterator<std::forward_iterator_tag, const Entry>
   {
   public:
     const_iterator() = default;
@@ -120,10 +131,10 @@
 
     ~const_iterator();
 
-    const fib::Entry&
+    const Entry&
     operator*() const;
 
-    shared_ptr<fib::Entry>
+    const Entry*
     operator->() const;
 
     const_iterator&
@@ -143,8 +154,8 @@
   };
 
 private:
-  shared_ptr<fib::Entry>
-  findLongestPrefixMatch(shared_ptr<name_tree::Entry> nameTreeEntry) const;
+  const Entry&
+  findLongestPrefixMatch(shared_ptr<name_tree::Entry> nte) const;
 
   void
   erase(shared_ptr<name_tree::Entry> nameTreeEntry);
@@ -153,13 +164,12 @@
   NameTree& m_nameTree;
   size_t m_nItems;
 
-  /** \brief The empty FIB entry.
+  /** \brief the empty FIB entry.
    *
    *  This entry has no nexthops.
    *  It is returned by findLongestPrefixMatch if nothing is matched.
-   *  Returning empty entry instead of nullptr makes forwarding and strategy implementation easier.
    */
-  static const shared_ptr<fib::Entry> s_emptyEntry;
+  static const unique_ptr<Entry> s_emptyEntry;
 };
 
 inline size_t
@@ -189,7 +199,7 @@
 Fib::const_iterator
 Fib::const_iterator::operator++(int)
 {
-  Fib::const_iterator temp(*this);
+  const_iterator temp(*this);
   ++(*this);
   return temp;
 }
@@ -201,30 +211,34 @@
   return *this;
 }
 
-inline const fib::Entry&
+inline const Entry&
 Fib::const_iterator::operator*() const
 {
-  return *this->operator->();
+  return *m_nameTreeIterator->getFibEntry();
 }
 
-inline shared_ptr<fib::Entry>
+inline const Entry*
 Fib::const_iterator::operator->() const
 {
   return m_nameTreeIterator->getFibEntry();
 }
 
 inline bool
-Fib::const_iterator::operator==(const Fib::const_iterator& other) const
+Fib::const_iterator::operator==(const const_iterator& other) const
 {
   return m_nameTreeIterator == other.m_nameTreeIterator;
 }
 
 inline bool
-Fib::const_iterator::operator!=(const Fib::const_iterator& other) const
+Fib::const_iterator::operator!=(const const_iterator& other) const
 {
   return m_nameTreeIterator != other.m_nameTreeIterator;
 }
 
+} // namespace fib
+
+using fib::Fib;
+
 } // namespace nfd
 
 #endif // NFD_DAEMON_TABLE_FIB_HPP
diff --git a/daemon/table/name-tree-entry.cpp b/daemon/table/name-tree-entry.cpp
index 889ed97..87853f2 100644
--- a/daemon/table/name-tree-entry.cpp
+++ b/daemon/table/name-tree-entry.cpp
@@ -65,14 +65,14 @@
 }
 
 void
-Entry::setFibEntry(shared_ptr<fib::Entry> fibEntry)
+Entry::setFibEntry(unique_ptr<fib::Entry> fibEntry)
 {
   BOOST_ASSERT(fibEntry == nullptr || fibEntry->m_nameTreeEntry.expired());
 
   if (m_fibEntry != nullptr) {
     m_fibEntry->m_nameTreeEntry.reset();
   }
-  m_fibEntry = fibEntry;
+  m_fibEntry = std::move(fibEntry);
 
   if (m_fibEntry != nullptr) {
     m_fibEntry->m_nameTreeEntry = this->shared_from_this();
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index 378d285..c650587 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -96,9 +96,9 @@
 
 public: // attached table entries
   void
-  setFibEntry(shared_ptr<fib::Entry> fibEntry);
+  setFibEntry(unique_ptr<fib::Entry> fibEntry);
 
-  shared_ptr<fib::Entry>
+  fib::Entry*
   getFibEntry() const;
 
   void
@@ -133,7 +133,7 @@
   Name m_prefix;
   shared_ptr<Entry> m_parent;     // Pointing to the parent entry.
   std::vector<shared_ptr<Entry> > m_children; // Children pointers.
-  shared_ptr<fib::Entry> m_fibEntry;
+  unique_ptr<fib::Entry> m_fibEntry;
   std::vector<shared_ptr<pit::Entry> > m_pitEntries;
   shared_ptr<measurements::Entry> m_measurementsEntry;
   shared_ptr<strategy_choice::Entry> m_strategyChoiceEntry;
@@ -187,10 +187,10 @@
   return !m_children.empty();
 }
 
-inline shared_ptr<fib::Entry>
+inline fib::Entry*
 Entry::getFibEntry() const
 {
-  return m_fibEntry;
+  return m_fibEntry.get();
 }
 
 inline bool
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index 87d4154..796e701 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -244,7 +244,7 @@
 NameTree::lookup(const fib::Entry& fibEntry) const
 {
   shared_ptr<name_tree::Entry> nte = this->getEntry(fibEntry);
-  BOOST_ASSERT(nte == nullptr || nte->getFibEntry().get() == &fibEntry);
+  BOOST_ASSERT(nte == nullptr || nte->getFibEntry() == &fibEntry);
   return nte;
 }
 
