diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 69c1a39..bb41fba 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -235,7 +235,7 @@
 std::tuple<Name, shared_ptr<AccessStrategy::MtInfo>>
 AccessStrategy::findPrefixMeasurements(const pit::Entry& pitEntry)
 {
-  shared_ptr<measurements::Entry> me = this->getMeasurements().findLongestPrefixMatch(pitEntry);
+  measurements::Entry* me = this->getMeasurements().findLongestPrefixMatch(pitEntry);
   if (me == nullptr) {
     return std::forward_as_tuple(Name(), nullptr);
   }
@@ -250,8 +250,8 @@
 shared_ptr<AccessStrategy::MtInfo>
 AccessStrategy::addPrefixMeasurements(const Data& data)
 {
-  shared_ptr<measurements::Entry> me;
-  if (data.getName().size() >= 1) {
+  measurements::Entry* me = nullptr;
+  if (!data.getName().empty()) {
     me = this->getMeasurements().get(data.getName().getPrefix(-1));
   }
   if (me == nullptr) { // parent of Data Name is not in this strategy, or Data Name is empty
diff --git a/daemon/fw/asf-measurements.cpp b/daemon/fw/asf-measurements.cpp
index 1a2eca2..11249f8 100644
--- a/daemon/fw/asf-measurements.cpp
+++ b/daemon/fw/asf-measurements.cpp
@@ -219,14 +219,14 @@
 shared_ptr<NamespaceInfo>
 AsfMeasurements::getNamespaceInfo(const ndn::Name& prefix)
 {
-  shared_ptr<measurements::Entry> me = m_measurements.findLongestPrefixMatch(prefix);
+  measurements::Entry* me = m_measurements.findLongestPrefixMatch(prefix);
 
   if (me == nullptr) {
     return nullptr;
   }
 
   // Set or update entry lifetime
-  extendLifetime(me);
+  extendLifetime(*me);
 
   shared_ptr<NamespaceInfo> info = me->getOrCreateStrategyInfo<NamespaceInfo>();
   BOOST_ASSERT(info != nullptr);
@@ -237,7 +237,7 @@
 NamespaceInfo&
 AsfMeasurements::getOrCreateNamespaceInfo(const fib::Entry& fibEntry, const ndn::Interest& interest)
 {
-  shared_ptr<measurements::Entry> me = m_measurements.get(fibEntry);
+  measurements::Entry* me = m_measurements.get(fibEntry);
 
   // If the FIB entry is not under the strategy's namespace, find a part of the prefix
   // that falls under the strategy's namespace
@@ -250,7 +250,7 @@
   BOOST_ASSERT(me != nullptr);
 
   // Set or update entry lifetime
-  extendLifetime(me);
+  extendLifetime(*me);
 
   shared_ptr<NamespaceInfo> info = me->getOrCreateStrategyInfo<NamespaceInfo>();
   BOOST_ASSERT(info != nullptr);
@@ -259,11 +259,9 @@
 }
 
 void
-AsfMeasurements::extendLifetime(shared_ptr<measurements::Entry> me)
+AsfMeasurements::extendLifetime(measurements::Entry& me)
 {
-  if (me != nullptr) {
-    m_measurements.extendLifetime(*me, MEASUREMENTS_LIFETIME);
-  }
+  m_measurements.extendLifetime(me, MEASUREMENTS_LIFETIME);
 }
 
 } // namespace asf
diff --git a/daemon/fw/asf-measurements.hpp b/daemon/fw/asf-measurements.hpp
index 8339d97..64f88c2 100644
--- a/daemon/fw/asf-measurements.hpp
+++ b/daemon/fw/asf-measurements.hpp
@@ -294,8 +294,9 @@
   NamespaceInfo&
   getOrCreateNamespaceInfo(const fib::Entry& fibEntry, const ndn::Interest& interest);
 
+private:
   void
-  extendLifetime(shared_ptr<measurements::Entry> me);
+  extendLifetime(measurements::Entry& me);
 
 public:
   static constexpr time::microseconds MEASUREMENTS_LIFETIME = time::seconds(300);
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index fc9cd20..213ce59 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -66,23 +66,22 @@
     return;
   }
 
-  shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
-    this->getMeasurementsEntryInfo(pitEntry);
+  MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
 
   time::microseconds deferFirst = DEFER_FIRST_WITHOUT_BEST_FACE;
   time::microseconds deferRange = DEFER_RANGE_WITHOUT_BEST_FACE;
   size_t nUpstreams = nexthops.size();
 
-  shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
+  shared_ptr<Face> bestFace = meInfo.getBestFace();
   if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace) &&
       canForwardToLegacy(*pitEntry, *bestFace)) {
     // TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
-    deferFirst = measurementsEntryInfo->prediction;
+    deferFirst = meInfo.prediction;
     deferRange = time::microseconds((deferFirst.count() + 1) / 2);
     --nUpstreams;
     this->sendInterest(pitEntry, *bestFace);
     pitEntryInfo->bestFaceTimeout = scheduler::schedule(
-      measurementsEntryInfo->prediction,
+      meInfo.prediction,
       bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
   }
   else {
@@ -96,7 +95,7 @@
     }
   }
 
-  shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
+  shared_ptr<Face> previousFace = meInfo.previousFace.lock();
   if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
     --nUpstreams;
@@ -131,10 +130,9 @@
   // from a timer set by NccStrategy.
   BOOST_ASSERT(pitEntryInfo != nullptr);
 
-  shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
-    this->getMeasurementsEntryInfo(pitEntry);
+  MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
 
-  shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
+  shared_ptr<Face> previousFace = meInfo.previousFace.lock();
   if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
     this->sendInterest(pitEntry, *previousFace);
@@ -156,8 +154,7 @@
       pitEntryInfo->maxInterval.count() - 1);
     time::nanoseconds deferNext = time::nanoseconds(dist(getGlobalRng()));
     pitEntryInfo->propagateTimer = scheduler::schedule(deferNext,
-    bind(&NccStrategy::doPropagate, this,
-         weak_ptr<pit::Entry>(pitEntry)));
+      bind(&NccStrategy::doPropagate, this, weak_ptr<pit::Entry>(pitEntry)));
   }
 }
 
@@ -165,21 +162,20 @@
 NccStrategy::timeoutOnBestFace(weak_ptr<pit::Entry> pitEntryWeak)
 {
   shared_ptr<pit::Entry> pitEntry = pitEntryWeak.lock();
-  if (!static_cast<bool>(pitEntry)) {
+  if (pitEntry == nullptr) {
     return;
   }
-  shared_ptr<measurements::Entry> measurementsEntry = this->getMeasurements().get(*pitEntry);
+  measurements::Entry* measurementsEntry = this->getMeasurements().get(*pitEntry);
 
   for (int i = 0; i < UPDATE_MEASUREMENTS_N_LEVELS; ++i) {
-    if (!static_cast<bool>(measurementsEntry)) {
+    if (measurementsEntry == nullptr) {
       // going out of this strategy's namespace
-      return;
+      break;
     }
     this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
 
-    shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
-      this->getMeasurementsEntryInfo(measurementsEntry);
-    measurementsEntryInfo->adjustPredictUp();
+    MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(measurementsEntry);
+    meInfo.adjustPredictUp();
 
     measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
   }
@@ -195,18 +191,17 @@
     return;
   }
 
-  shared_ptr<measurements::Entry> measurementsEntry = this->getMeasurements().get(*pitEntry);
+  measurements::Entry* measurementsEntry = this->getMeasurements().get(*pitEntry);
 
   for (int i = 0; i < UPDATE_MEASUREMENTS_N_LEVELS; ++i) {
-    if (!static_cast<bool>(measurementsEntry)) {
+    if (measurementsEntry == nullptr) {
       // going out of this strategy's namespace
       return;
     }
     this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
 
-    shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
-      this->getMeasurementsEntryInfo(measurementsEntry);
-    measurementsEntryInfo->updateBestFace(inFace);
+    MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(measurementsEntry);
+    meInfo.updateBestFace(inFace);
 
     measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
   }
@@ -216,41 +211,40 @@
     scheduler::cancel(pitEntryInfo->propagateTimer);
 
     // Verify that the best face satisfied the interest before canceling the timeout call
-    shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
-      this->getMeasurementsEntryInfo(pitEntry);
-    shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
+    MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
+    shared_ptr<Face> bestFace = meInfo.getBestFace();
 
     if (bestFace.get() == &inFace)
       scheduler::cancel(pitEntryInfo->bestFaceTimeout);
   }
 }
 
-shared_ptr<NccStrategy::MeasurementsEntryInfo>
+NccStrategy::MeasurementsEntryInfo&
 NccStrategy::getMeasurementsEntryInfo(shared_ptr<pit::Entry> entry)
 {
-  shared_ptr<measurements::Entry> measurementsEntry = this->getMeasurements().get(*entry);
+  measurements::Entry* measurementsEntry = this->getMeasurements().get(*entry);
   return this->getMeasurementsEntryInfo(measurementsEntry);
 }
 
-shared_ptr<NccStrategy::MeasurementsEntryInfo>
-NccStrategy::getMeasurementsEntryInfo(shared_ptr<measurements::Entry> entry)
+NccStrategy::MeasurementsEntryInfo&
+NccStrategy::getMeasurementsEntryInfo(measurements::Entry* entry)
 {
+  BOOST_ASSERT(entry != nullptr);
   shared_ptr<MeasurementsEntryInfo> info = entry->getStrategyInfo<MeasurementsEntryInfo>();
-  if (static_cast<bool>(info)) {
-    return info;
+  if (info != nullptr) {
+    return *info;
   }
 
   info = make_shared<MeasurementsEntryInfo>();
   entry->setStrategyInfo(info);
 
-  shared_ptr<measurements::Entry> parentEntry = this->getMeasurements().getParent(*entry);
-  if (static_cast<bool>(parentEntry)) {
-    shared_ptr<MeasurementsEntryInfo> parentInfo = this->getMeasurementsEntryInfo(parentEntry);
-    BOOST_ASSERT(static_cast<bool>(parentInfo));
-    info->inheritFrom(*parentInfo);
+  measurements::Entry* parentEntry = this->getMeasurements().getParent(*entry);
+  if (parentEntry != nullptr) {
+    MeasurementsEntryInfo& parentInfo = this->getMeasurementsEntryInfo(parentEntry);
+    info->inheritFrom(parentInfo);
   }
 
-  return info;
+  return *info;
 }
 
 
@@ -275,7 +269,7 @@
 shared_ptr<Face>
 NccStrategy::MeasurementsEntryInfo::getBestFace(void) {
   shared_ptr<Face> best = this->bestFace.lock();
-  if (static_cast<bool>(best)) {
+  if (best != nullptr) {
     return best;
   }
   this->bestFace = best = this->previousFace.lock();
diff --git a/daemon/fw/ncc-strategy.hpp b/daemon/fw/ncc-strategy.hpp
index bfbb06d..80e2918 100644
--- a/daemon/fw/ncc-strategy.hpp
+++ b/daemon/fw/ncc-strategy.hpp
@@ -117,10 +117,10 @@
   };
 
 protected:
-  shared_ptr<MeasurementsEntryInfo>
-  getMeasurementsEntryInfo(shared_ptr<measurements::Entry> entry);
+  MeasurementsEntryInfo&
+  getMeasurementsEntryInfo(measurements::Entry* entry);
 
-  shared_ptr<MeasurementsEntryInfo>
+  MeasurementsEntryInfo&
   getMeasurementsEntryInfo(shared_ptr<pit::Entry> entry);
 
   /// propagate to another upstream
