diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index b82ba40..6ae2767 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -36,7 +36,8 @@
 
 AccessStrategy::AccessStrategy(Forwarder& forwarder, const Name& name)
   : Strategy(forwarder)
-  , m_removeFaceInfoConn(beforeRemoveFace.connect([this] (const Face& face) { removeFaceInfo(face); }))
+  , m_rttEstimatorOpts(make_shared<RttEstimator::Options>()) // use the default options
+  , m_removeFaceConn(beforeRemoveFace.connect([this] (const Face& face) { m_fit.erase(face.getId()); }))
 {
   ParsedInstanceName parsed = parseInstanceName(name);
   if (!parsed.parameters.empty()) {
@@ -139,7 +140,7 @@
     return false;
   }
 
-  auto rto = mi.rtt.computeRto();
+  auto rto = mi.rtt.getEstimatedRto();
   NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop
                 << " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
 
@@ -147,10 +148,11 @@
 
   // schedule RTO timeout
   PitInfo* pi = pitEntry->insertStrategyInfo<PitInfo>().first;
-  pi->rtoTimer = getScheduler().schedule(rto, [=] {
-    afterRtoTimeout(weak_ptr<pit::Entry>(pitEntry),
-                    ingress.face.getId(), ingress.endpoint, mi.lastNexthop);
-  });
+  pi->rtoTimer = getScheduler().schedule(rto,
+    [this, pitWeak = weak_ptr<pit::Entry>(pitEntry), face = ingress.face.getId(),
+     endpoint = ingress.endpoint, lastNexthop = mi.lastNexthop] {
+      afterRtoTimeout(pitWeak, face, endpoint, lastNexthop);
+    });
 
   return true;
 }
@@ -226,15 +228,16 @@
   auto rtt = time::steady_clock::now() - outRecord->getLastRenewed();
   NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress
                 << " rtt=" << time::duration_cast<time::microseconds>(rtt).count());
-  this->updateMeasurements(ingress.face, data, time::duration_cast<RttEstimator::Duration>(rtt));
+  this->updateMeasurements(ingress.face, data, rtt);
 }
 
 void
-AccessStrategy::updateMeasurements(const Face& inFace, const Data& data,
-                                   const RttEstimator::Duration& rtt)
+AccessStrategy::updateMeasurements(const Face& inFace, const Data& data, time::nanoseconds rtt)
 {
-  ///\todo move FaceInfoTable out of AccessStrategy instance, to Measurements or somewhere else
-  FaceInfo& fi = m_fit[inFace.getId()];
+  auto ret = m_fit.emplace(std::piecewise_construct,
+                           std::forward_as_tuple(inFace.getId()),
+                           std::forward_as_tuple(m_rttEstimatorOpts));
+  FaceInfo& fi = ret.first->second;
   fi.rtt.addMeasurement(rtt);
 
   MtInfo* mi = this->addPrefixMeasurements(data);
@@ -276,14 +279,7 @@
   }
 
   this->getMeasurements().extendLifetime(*me, 8_s);
-
-  return me->insertStrategyInfo<MtInfo>().first;
-}
-
-void
-AccessStrategy::removeFaceInfo(const Face& face)
-{
-  m_fit.erase(face.getId());
+  return me->insertStrategyInfo<MtInfo>(m_rttEstimatorOpts).first;
 }
 
 } // namespace fw
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index 857592b..0ce8917 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.hpp
@@ -28,7 +28,8 @@
 
 #include "strategy.hpp"
 #include "retx-suppression-fixed.hpp"
-#include "core/rtt-estimator.hpp"
+
+#include <ndn-cxx/util/rtt-estimator.hpp>
 
 namespace nfd {
 namespace fw {
@@ -65,6 +66,8 @@
                         const FaceEndpoint& ingress, const Data& data) override;
 
 private: // StrategyInfo
+  using RttEstimator = ndn::util::RttEstimator;
+
   /** \brief StrategyInfo on PIT entry
    */
   class PitInfo : public StrategyInfo
@@ -91,9 +94,15 @@
       return 1011;
     }
 
+    explicit
+    MtInfo(shared_ptr<const RttEstimator::Options> opts)
+      : rtt(std::move(opts))
+    {
+    }
+
   public:
     FaceId lastNexthop = face::INVALID_FACEID;
-    RttEstimator rtt{1, 1_ms, 0.1};
+    RttEstimator rtt;
   };
 
   /** \brief find per-prefix measurements for Interest
@@ -108,17 +117,22 @@
   addPrefixMeasurements(const Data& data);
 
   /** \brief global per-face StrategyInfo
+   *  \todo Currently stored inside AccessStrategy instance; should be moved
+   *        to measurements table or somewhere else.
    */
-  struct FaceInfo
+  class FaceInfo
   {
-    RttEstimator rtt{1, 1_ms, 0.1};
+  public:
+    explicit
+    FaceInfo(shared_ptr<const RttEstimator::Options> opts)
+      : rtt(std::move(opts))
+    {
+    }
+
+  public:
+    RttEstimator rtt;
   };
 
-  typedef std::unordered_map<FaceId, FaceInfo> FaceInfoTable;
-
-  void
-  removeFaceInfo(const Face& face);
-
 private: // forwarding procedures
   void
   afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
@@ -141,8 +155,8 @@
                   FaceId inFaceId, EndpointId inEndpointId, FaceId firstOutFaceId);
 
   /** \brief multicast to all nexthops
-   *  \param exceptFace don't forward to this face; also, inFace is always excluded
-   *  \return how many Interests are sent
+   *  \param exceptFace don't forward to this face; also, \p inFace is always excluded
+   *  \return number of Interests that were sent
    */
   size_t
   multicast(const Face& inFace, const Interest& interest,
@@ -150,13 +164,13 @@
             FaceId exceptFace = face::INVALID_FACEID);
 
   void
-  updateMeasurements(const Face& inFace, const Data& data,
-                     const RttEstimator::Duration& rtt);
+  updateMeasurements(const Face& inFace, const Data& data, time::nanoseconds rtt);
 
 private:
-  FaceInfoTable m_fit;
+  const shared_ptr<const RttEstimator::Options> m_rttEstimatorOpts;
+  std::unordered_map<FaceId, FaceInfo> m_fit;
   RetxSuppressionFixed m_retxSuppression;
-  signal::ScopedConnection m_removeFaceInfoConn;
+  signal::ScopedConnection m_removeFaceConn;
 };
 
 } // namespace fw
