diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 8dfcba2..e1443df 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -57,15 +57,15 @@
 }
 
 void
-AccessStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                      const shared_ptr<pit::Entry>& pitEntry)
 {
   auto suppressResult = m_retxSuppression.decidePerPitEntry(*pitEntry);
   switch (suppressResult) {
   case RetxSuppressionResult::NEW:
-    return afterReceiveNewInterest(ingress, interest, pitEntry);
+    return afterReceiveNewInterest(interest, ingress, pitEntry);
   case RetxSuppressionResult::FORWARD:
-    return afterReceiveRetxInterest(ingress, interest, pitEntry);
+    return afterReceiveRetxInterest(interest, ingress, pitEntry);
   case RetxSuppressionResult::SUPPRESS:
     NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " retx-suppress");
     return;
@@ -73,7 +73,7 @@
 }
 
 void
-AccessStrategy::afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveNewInterest(const Interest& interest, const FaceEndpoint& ingress,
                                         const shared_ptr<pit::Entry>& pitEntry)
 {
   const auto& fibEntry = this->lookupFib(*pitEntry);
@@ -86,7 +86,7 @@
     NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " new-interest mi=" << miName);
 
     // send to last working nexthop
-    bool isSentToLastNexthop = this->sendToLastNexthop(ingress, interest, pitEntry, *mi, fibEntry);
+    bool isSentToLastNexthop = this->sendToLastNexthop(interest, ingress, pitEntry, *mi, fibEntry);
     if (isSentToLastNexthop) {
       return;
     }
@@ -98,7 +98,7 @@
   // no measurements, or last working nexthop unavailable
 
   // multicast to all nexthops except incoming face
-  size_t nMulticastSent = this->multicast(ingress.face, interest, pitEntry, fibEntry);
+  size_t nMulticastSent = this->multicast(interest, ingress.face, pitEntry, fibEntry);
 
   if (nMulticastSent == 0) {
     this->rejectPendingInterest(pitEntry);
@@ -106,16 +106,16 @@
 }
 
 void
-AccessStrategy::afterReceiveRetxInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress,
                                          const shared_ptr<pit::Entry>& pitEntry)
 {
   const auto& fibEntry = this->lookupFib(*pitEntry);
   NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " retx-forward");
-  this->multicast(ingress.face, interest, pitEntry, fibEntry);
+  this->multicast(interest, ingress.face, pitEntry, fibEntry);
 }
 
 bool
-AccessStrategy::sendToLastNexthop(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::sendToLastNexthop(const Interest& interest, const FaceEndpoint& ingress,
                                   const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
                                   const fib::Entry& fibEntry)
 {
@@ -144,7 +144,7 @@
   NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop
                 << " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
 
-  if (!this->sendInterest(pitEntry, *outFace, interest)) {
+  if (!this->sendInterest(interest, *outFace, pitEntry)) {
     return false;
   }
 
@@ -184,11 +184,11 @@
 
   NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId
                 << " multicast-except " << firstOutFaceId);
-  this->multicast(*inFace, interest, pitEntry, fibEntry, firstOutFaceId);
+  this->multicast(interest, *inFace, pitEntry, fibEntry, firstOutFaceId);
 }
 
 size_t
-AccessStrategy::multicast(const Face& inFace, const Interest& interest,
+AccessStrategy::multicast(const Interest& interest, const Face& inFace,
                           const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
                           FaceId exceptFace)
 {
@@ -200,7 +200,7 @@
       continue;
     }
     NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << outFace.getId() << " multicast");
-    if (this->sendInterest(pitEntry, outFace, interest)) {
+    if (this->sendInterest(interest, outFace, pitEntry)) {
       ++nSent;
     }
   }
@@ -208,8 +208,8 @@
 }
 
 void
-AccessStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                      const FaceEndpoint& ingress, const Data& data)
+AccessStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                                      const shared_ptr<pit::Entry>& pitEntry)
 {
   PitInfo* pi = pitEntry->getStrategyInfo<PitInfo>();
   if (pi != nullptr) {
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index 0f83a64..edcf63b 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.hpp
@@ -56,12 +56,12 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const FaceEndpoint& ingress, const Data& data) override;
+  beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                        const shared_ptr<pit::Entry>& pitEntry) override;
 
 private: // StrategyInfo
   using RttEstimator = ndn::util::RttEstimator;
@@ -133,18 +133,18 @@
 
 private: // forwarding procedures
   void
-  afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveNewInterest(const Interest& interest, const FaceEndpoint& ingress,
                           const shared_ptr<pit::Entry>& pitEntry);
 
   void
-  afterReceiveRetxInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress,
                            const shared_ptr<pit::Entry>& pitEntry);
 
   /** \brief send to last working nexthop
    *  \return whether an Interest is sent
    */
   bool
-  sendToLastNexthop(const FaceEndpoint& ingress, const Interest& interest,
+  sendToLastNexthop(const Interest& interest, const FaceEndpoint& ingress,
                     const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
                     const fib::Entry& fibEntry);
 
@@ -157,7 +157,7 @@
    *  \return number of Interests that were sent
    */
   size_t
-  multicast(const Face& inFace, const Interest& interest,
+  multicast(const Interest& interest, const Face& inFace,
             const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
             FaceId exceptFace = face::INVALID_FACEID);
 
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index d8959af..f337a27 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -107,7 +107,7 @@
 }
 
 void
-AsfStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+AsfStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                   const shared_ptr<pit::Entry>& pitEntry)
 {
   const auto& fibEntry = this->lookupFib(*pitEntry);
@@ -165,7 +165,7 @@
     NFD_LOG_DEBUG(interest << " retx-interest from=" << ingress << " retry-to=" << outFace.getId());
     // sendInterest() is used here instead of forwardInterest() because the measurements info
     // were already attached to this face in the previous forwarding
-    auto* outRecord = sendInterest(pitEntry, outFace, interest);
+    auto* outRecord = sendInterest(interest, outFace, pitEntry);
     if (outRecord && suppressResult == RetxSuppressionResult::FORWARD) {
       m_retxSuppression.incrementIntervalForOutRecord(*outRecord);
     }
@@ -173,8 +173,8 @@
 }
 
 void
-AsfStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                   const FaceEndpoint& ingress, const Data& data)
+AsfStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                                   const shared_ptr<pit::Entry>& pitEntry)
 {
   NamespaceInfo* namespaceInfo = m_measurements.getNamespaceInfo(pitEntry->getName());
   if (namespaceInfo == nullptr) {
@@ -207,7 +207,7 @@
 }
 
 void
-AsfStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+AsfStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                               const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG(nack.getInterest() << " nack from=" << ingress << " reason=" << nack.getReason());
@@ -221,7 +221,7 @@
   const auto& interestName = interest.getName();
   auto faceId = outFace.getId();
 
-  auto* outRecord = sendInterest(pitEntry, outFace, interest);
+  auto* outRecord = sendInterest(interest, outFace, pitEntry);
 
   FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interestName, faceId);
 
@@ -361,7 +361,7 @@
 {
   lp::NackHeader nackHeader;
   nackHeader.setReason(lp::NackReason::NO_ROUTE);
-  this->sendNack(pitEntry, face, nackHeader);
+  this->sendNack(nackHeader, face, pitEntry);
   this->rejectPendingInterest(pitEntry);
 }
 
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index 932cffa..2e0ba24 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -53,15 +53,15 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const FaceEndpoint& ingress, const Data& data) override;
+  beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index e684250..eecc3b5 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -62,7 +62,7 @@
 }
 
 void
-BestRouteStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+BestRouteStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                         const shared_ptr<pit::Entry>& pitEntry)
 {
   RetxSuppressionResult suppression = m_retxSuppression.decidePerPitEntry(*pitEntry);
@@ -86,15 +86,14 @@
 
       lp::NackHeader nackHeader;
       nackHeader.setReason(lp::NackReason::NO_ROUTE);
-      this->sendNack(pitEntry, ingress.face, nackHeader);
-
+      this->sendNack(nackHeader, ingress.face, pitEntry);
       this->rejectPendingInterest(pitEntry);
       return;
     }
 
     Face& outFace = it->getFace();
     NFD_LOG_DEBUG(interest << " from=" << ingress << " newPitEntry-to=" << outFace.getId());
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(interest, outFace, pitEntry);
     return;
   }
 
@@ -106,7 +105,7 @@
 
   if (it != nexthops.end()) {
     Face& outFace = it->getFace();
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(interest, outFace, pitEntry);
     NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-unused-to=" << outFace.getId());
     return;
   }
@@ -118,16 +117,16 @@
   }
   else {
     Face& outFace = it->getFace();
-    this->sendInterest(pitEntry, outFace, interest);
+    this->sendInterest(interest, outFace, pitEntry);
     NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-retry-to=" << outFace.getId());
   }
 }
 
 void
-BestRouteStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+BestRouteStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                                     const shared_ptr<pit::Entry>& pitEntry)
 {
-  this->processNack(ingress.face, nack, pitEntry);
+  this->processNack(nack, ingress.face, pitEntry);
 }
 
 } // namespace fw
diff --git a/daemon/fw/best-route-strategy.hpp b/daemon/fw/best-route-strategy.hpp
index 636abd2..3f11c7a 100644
--- a/daemon/fw/best-route-strategy.hpp
+++ b/daemon/fw/best-route-strategy.hpp
@@ -60,12 +60,13 @@
   static const Name&
   getStrategyName();
 
+public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 171a541..fea18f6 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -57,19 +57,19 @@
   m_faceTable.afterAdd.connect([this] (const Face& face) {
     face.afterReceiveInterest.connect(
       [this, &face] (const Interest& interest, const EndpointId& endpointId) {
-        this->startProcessInterest(FaceEndpoint(face, endpointId), interest);
+        this->onIncomingInterest(interest, FaceEndpoint(const_cast<Face&>(face), endpointId));
       });
     face.afterReceiveData.connect(
       [this, &face] (const Data& data, const EndpointId& endpointId) {
-        this->startProcessData(FaceEndpoint(face, endpointId), data);
+        this->onIncomingData(data, FaceEndpoint(const_cast<Face&>(face), endpointId));
       });
     face.afterReceiveNack.connect(
       [this, &face] (const lp::Nack& nack, const EndpointId& endpointId) {
-        this->startProcessNack(FaceEndpoint(face, endpointId), nack);
+        this->onIncomingNack(nack, FaceEndpoint(const_cast<Face&>(face), endpointId));
       });
     face.onDroppedInterest.connect(
       [this, &face] (const Interest& interest) {
-        this->onDroppedInterest(face, interest);
+        this->onDroppedInterest(interest, const_cast<Face&>(face));
       });
   });
 
@@ -87,7 +87,7 @@
 Forwarder::~Forwarder() = default;
 
 void
-Forwarder::onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest)
+Forwarder::onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress)
 {
   // receive Interest
   NFD_LOG_DEBUG("onIncomingInterest in=" << ingress << " interest=" << interest.getName());
@@ -96,13 +96,13 @@
 
   // drop if HopLimit zero, decrement otherwise (if present)
   if (interest.getHopLimit()) {
-    if (*interest.getHopLimit() < 1) {
+    if (*interest.getHopLimit() == 0) {
       NFD_LOG_DEBUG("onIncomingInterest in=" << ingress << " interest=" << interest.getName()
                     << " hop-limit=0");
-      ++const_cast<PacketCounter&>(ingress.face.getCounters().nInHopLimitZero);
+      ++ingress.face.getCounters().nInHopLimitZero;
+      // drop
       return;
     }
-
     const_cast<Interest&>(interest).setHopLimit(*interest.getHopLimit() - 1);
   }
 
@@ -112,7 +112,7 @@
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onIncomingInterest in=" << ingress
                   << " interest=" << interest.getName() << " violates /localhost");
-    // (drop)
+    // drop
     return;
   }
 
@@ -120,7 +120,7 @@
   bool hasDuplicateNonceInDnl = m_deadNonceList.has(interest.getName(), interest.getNonce());
   if (hasDuplicateNonceInDnl) {
     // goto Interest loop pipeline
-    this->onInterestLoop(ingress, interest);
+    this->onInterestLoop(interest, ingress);
     return;
   }
 
@@ -144,23 +144,23 @@
   }
   if (hasDuplicateNonceInPit) {
     // goto Interest loop pipeline
-    this->onInterestLoop(ingress, interest);
+    this->onInterestLoop(interest, ingress);
     return;
   }
 
   // is pending?
   if (!pitEntry->hasInRecords()) {
     m_cs.find(interest,
-              bind(&Forwarder::onContentStoreHit, this, ingress, pitEntry, _1, _2),
-              bind(&Forwarder::onContentStoreMiss, this, ingress, pitEntry, _1));
+              [=] (const Interest& i, const Data& d) { onContentStoreHit(i, ingress, pitEntry, d); },
+              [=] (const Interest& i) { onContentStoreMiss(i, ingress, pitEntry); });
   }
   else {
-    this->onContentStoreMiss(ingress, pitEntry, interest);
+    this->onContentStoreMiss(interest, ingress, pitEntry);
   }
 }
 
 void
-Forwarder::onInterestLoop(const FaceEndpoint& ingress, const Interest& interest)
+Forwarder::onInterestLoop(const Interest& interest, const FaceEndpoint& ingress)
 {
   // if multi-access or ad hoc face, drop
   if (ingress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
@@ -180,8 +180,8 @@
 }
 
 void
-Forwarder::onContentStoreMiss(const FaceEndpoint& ingress,
-                              const shared_ptr<pit::Entry>& pitEntry, const Interest& interest)
+Forwarder::onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress,
+                              const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
   ++m_counters.nCsMisses;
@@ -207,19 +207,19 @@
                     << " nexthop-faceid=" << nextHopFace->getId());
       // go to outgoing Interest pipeline
       // scope control is unnecessary, because privileged app explicitly wants to forward
-      this->onOutgoingInterest(pitEntry, *nextHopFace, interest);
+      this->onOutgoingInterest(interest, *nextHopFace, pitEntry);
     }
     return;
   }
 
   // dispatch to strategy: after receive Interest
   m_strategyChoice.findEffectiveStrategy(*pitEntry)
-    .afterReceiveInterest(FaceEndpoint(ingress.face, 0), interest, pitEntry);
+    .afterReceiveInterest(interest, FaceEndpoint(ingress.face, 0), pitEntry);
 }
 
 void
-Forwarder::onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
-                             const Interest& interest, const Data& data)
+Forwarder::onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress,
+                             const shared_ptr<pit::Entry>& pitEntry, const Data& data)
 {
   NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
   ++m_counters.nCsHits;
@@ -235,18 +235,18 @@
   this->setExpiryTimer(pitEntry, 0_ms);
 
   // dispatch to strategy: after Content Store hit
-  m_strategyChoice.findEffectiveStrategy(*pitEntry).afterContentStoreHit(pitEntry, ingress, data);
+  m_strategyChoice.findEffectiveStrategy(*pitEntry).afterContentStoreHit(data, ingress, pitEntry);
 }
 
 pit::OutRecord*
-Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
-                              Face& egress, const Interest& interest)
+Forwarder::onOutgoingInterest(const Interest& interest, Face& egress,
+                              const shared_ptr<pit::Entry>& pitEntry)
 {
   // drop if HopLimit == 0 but sending on non-local face
   if (interest.getHopLimit() == 0 && egress.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
     NFD_LOG_DEBUG("onOutgoingInterest out=" << egress.getId() << " interest=" << pitEntry->getName()
                   << " non-local hop-limit=0");
-    ++const_cast<PacketCounter&>(egress.getCounters().nOutHopLimitZero);
+    ++egress.getCounters().nOutHopLimitZero;
     return nullptr;
   }
 
@@ -285,7 +285,7 @@
 }
 
 void
-Forwarder::onIncomingData(const FaceEndpoint& ingress, const Data& data)
+Forwarder::onIncomingData(const Data& data, const FaceEndpoint& ingress)
 {
   // receive Data
   NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName());
@@ -297,7 +297,7 @@
                               scope_prefix::LOCALHOST.isPrefixOf(data.getName());
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName() << " violates /localhost");
-    // (drop)
+    // drop
     return;
   }
 
@@ -305,7 +305,7 @@
   pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);
   if (pitMatches.size() == 0) {
     // goto Data unsolicited pipeline
-    this->onDataUnsolicited(ingress, data);
+    this->onDataUnsolicited(data, ingress);
     return;
   }
 
@@ -322,7 +322,7 @@
     this->setExpiryTimer(pitEntry, 0_ms);
 
     // trigger strategy: after receive Data
-    m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveData(pitEntry, ingress, data);
+    m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveData(data, ingress, pitEntry);
 
     // mark PIT satisfied
     pitEntry->isSatisfied = true;
@@ -354,7 +354,7 @@
       this->setExpiryTimer(pitEntry, 0_ms);
 
       // invoke PIT satisfy callback
-      m_strategyChoice.findEffectiveStrategy(*pitEntry).beforeSatisfyInterest(pitEntry, ingress, data);
+      m_strategyChoice.findEffectiveStrategy(*pitEntry).beforeSatisfyInterest(data, ingress, pitEntry);
 
       // mark PIT satisfied
       pitEntry->isSatisfied = true;
@@ -381,7 +381,7 @@
 }
 
 void
-Forwarder::onDataUnsolicited(const FaceEndpoint& ingress, const Data& data)
+Forwarder::onDataUnsolicited(const Data& data, const FaceEndpoint& ingress)
 {
   // accept to cache?
   auto decision = m_unsolicitedDataPolicy->decide(ingress.face, data);
@@ -410,7 +410,7 @@
   if (isViolatingLocalhost) {
     NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName()
                   << " violates /localhost");
-    // (drop)
+    // drop
     return false;
   }
 
@@ -424,7 +424,7 @@
 }
 
 void
-Forwarder::onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack)
+Forwarder::onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress)
 {
   // receive Nack
   nack.setTag(make_shared<lp::IncomingFaceIdTag>(ingress.face.getId()));
@@ -476,12 +476,12 @@
   }
 
   // trigger strategy: after receive NACK
-  m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveNack(ingress, nack, pitEntry);
+  m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveNack(nack, ingress, pitEntry);
 }
 
 bool
-Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
-                          Face& egress, const lp::NackHeader& nack)
+Forwarder::onOutgoingNack(const lp::NackHeader& nack, Face& egress,
+                          const shared_ptr<pit::Entry>& pitEntry)
 {
   if (egress.getId() == face::INVALID_FACEID) {
     NFD_LOG_WARN("onOutgoingNack out=(invalid)"
@@ -527,9 +527,9 @@
 }
 
 void
-Forwarder::onDroppedInterest(const Face& egress, const Interest& interest)
+Forwarder::onDroppedInterest(const Interest& interest, Face& egress)
 {
-  m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(egress, interest);
+  m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(interest, egress);
 }
 
 void
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 51e4dd0..6a245de 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -44,9 +44,10 @@
 class Strategy;
 } // namespace fw
 
-/** \brief Main class of NFD's forwarding engine.
+/**
+ * \brief Main class of NFD's forwarding engine.
  *
- *  Forwarder owns all tables and implements the forwarding pipelines.
+ * The Forwarder class owns all tables and implements the forwarding pipelines.
  */
 class Forwarder
 {
@@ -76,37 +77,6 @@
     m_unsolicitedDataPolicy = std::move(policy);
   }
 
-public: // forwarding entrypoints and tables
-  /** \brief start incoming Interest processing
-   *  \param ingress face on which Interest is received and endpoint of the sender
-   *  \param interest the incoming Interest, must be well-formed and created with make_shared
-   */
-  void
-  startProcessInterest(const FaceEndpoint& ingress, const Interest& interest)
-  {
-    this->onIncomingInterest(ingress, interest);
-  }
-
-  /** \brief start incoming Data processing
-   *  \param ingress face on which Data is received and endpoint of the sender
-   *  \param data the incoming Data, must be well-formed and created with make_shared
-   */
-  void
-  startProcessData(const FaceEndpoint& ingress, const Data& data)
-  {
-    this->onIncomingData(ingress, data);
-  }
-
-  /** \brief start incoming Nack processing
-   *  \param ingress face on which Nack is received and endpoint of the sender
-   *  \param nack the incoming Nack, must be well-formed
-   */
-  void
-  startProcessNack(const FaceEndpoint& ingress, const lp::Nack& nack)
-  {
-    this->onIncomingNack(ingress, nack);
-  }
-
   NameTree&
   getNameTree()
   {
@@ -157,33 +127,35 @@
 
 NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines
   /** \brief incoming Interest pipeline
+   *  \param interest the incoming Interest, must be well-formed and created with make_shared
+   *  \param ingress face on which \p interest was received and endpoint of the sender
    */
   NFD_VIRTUAL_WITH_TESTS void
-  onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest);
+  onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress);
 
   /** \brief Interest loop pipeline
    */
   NFD_VIRTUAL_WITH_TESTS void
-  onInterestLoop(const FaceEndpoint& ingress, const Interest& interest);
+  onInterestLoop(const Interest& interest, const FaceEndpoint& ingress);
 
   /** \brief Content Store miss pipeline
   */
   NFD_VIRTUAL_WITH_TESTS void
-  onContentStoreMiss(const FaceEndpoint& ingress,
-                     const shared_ptr<pit::Entry>& pitEntry, const Interest& interest);
+  onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress,
+                     const shared_ptr<pit::Entry>& pitEntry);
 
   /** \brief Content Store hit pipeline
   */
   NFD_VIRTUAL_WITH_TESTS void
-  onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
-                    const Interest& interest, const Data& data);
+  onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress,
+                    const shared_ptr<pit::Entry>& pitEntry, const Data& data);
 
   /** \brief outgoing Interest pipeline
    *  \return A pointer to the out-record created or nullptr if the Interest was dropped
    */
   NFD_VIRTUAL_WITH_TESTS pit::OutRecord*
-  onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
-                     Face& egress, const Interest& interest);
+  onOutgoingInterest(const Interest& interest, Face& egress,
+                     const shared_ptr<pit::Entry>& pitEntry);
 
   /** \brief Interest finalize pipeline
    */
@@ -191,14 +163,16 @@
   onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry);
 
   /** \brief incoming Data pipeline
+   *  \param data the incoming Data, must be well-formed and created with make_shared
+   *  \param ingress face on which \p data was received and endpoint of the sender
    */
   NFD_VIRTUAL_WITH_TESTS void
-  onIncomingData(const FaceEndpoint& ingress, const Data& data);
+  onIncomingData(const Data& data, const FaceEndpoint& ingress);
 
   /** \brief Data unsolicited pipeline
    */
   NFD_VIRTUAL_WITH_TESTS void
-  onDataUnsolicited(const FaceEndpoint& ingress, const Data& data);
+  onDataUnsolicited(const Data& data, const FaceEndpoint& ingress);
 
   /** \brief outgoing Data pipeline
    *  \return Whether the Data was transmitted (true) or dropped (false)
@@ -207,19 +181,21 @@
   onOutgoingData(const Data& data, Face& egress);
 
   /** \brief incoming Nack pipeline
+   *  \param nack the incoming Nack, must be well-formed
+   *  \param ingress face on which \p nack is received and endpoint of the sender
    */
   NFD_VIRTUAL_WITH_TESTS void
-  onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack);
+  onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress);
 
   /** \brief outgoing Nack pipeline
    *  \return Whether the Nack was transmitted (true) or dropped (false)
    */
   NFD_VIRTUAL_WITH_TESTS bool
-  onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
-                 Face& egress, const lp::NackHeader& nack);
+  onOutgoingNack(const lp::NackHeader& nack, Face& egress,
+                 const shared_ptr<pit::Entry>& pitEntry);
 
   NFD_VIRTUAL_WITH_TESTS void
-  onDroppedInterest(const Face& egress, const Interest& interest);
+  onDroppedInterest(const Interest& interest, Face& egress);
 
   NFD_VIRTUAL_WITH_TESTS void
   onNewNextHop(const Name& prefix, const fib::NextHop& nextHop);
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 866b8ae..090a560 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -62,7 +62,7 @@
 }
 
 void
-MulticastStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+MulticastStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                         const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -83,7 +83,7 @@
     }
 
     NFD_LOG_DEBUG(interest << " from=" << ingress << " pitEntry-to=" << outFace.getId());
-    auto* sentOutRecord = this->sendInterest(pitEntry, outFace, interest);
+    auto* sentOutRecord = this->sendInterest(interest, outFace, pitEntry);
     if (sentOutRecord && suppressResult == RetxSuppressionResult::FORWARD) {
       m_retxSuppression.incrementIntervalForOutRecord(*sentOutRecord);
     }
@@ -105,7 +105,7 @@
     if (isNextHopEligible(inFace, interest, nextHop, pitEntry)) {
 
       NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " pitEntry-to=" << nextHopFaceId);
-      this->sendInterest(pitEntry, nextHop.getFace(), interest);
+      this->sendInterest(interest, nextHop.getFace(), pitEntry);
 
       break; // just one eligible incoming face record is enough
     }
diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp
index 7ef0080..fe122a4 100644
--- a/daemon/fw/multicast-strategy.hpp
+++ b/daemon/fw/multicast-strategy.hpp
@@ -43,8 +43,9 @@
   static const Name&
   getStrategyName();
 
+public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index ed599d9..80e5c40 100644
--- a/daemon/fw/process-nack-traits.cpp
+++ b/daemon/fw/process-nack-traits.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -32,7 +32,7 @@
 NFD_LOG_INIT(ProcessNackTraits);
 
 void
-ProcessNackTraitsBase::processNack(const Face& inFace, const lp::Nack& nack,
+ProcessNackTraitsBase::processNack(const lp::Nack& nack, const Face& inFace,
                                    const shared_ptr<pit::Entry>& pitEntry)
 {
   int nOutRecordsNotNacked = 0;
@@ -56,7 +56,7 @@
 
   if (nOutRecordsNotNacked == 1) {
     BOOST_ASSERT(lastFaceNotNacked != nullptr);
-    pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
+    auto inR = pitEntry->getInRecord(*lastFaceNotNacked);
     if (inR != pitEntry->in_end()) {
       // one out-record not Nacked, which is also a downstream
       NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
diff --git a/daemon/fw/process-nack-traits.hpp b/daemon/fw/process-nack-traits.hpp
index 654c896..c07537b 100644
--- a/daemon/fw/process-nack-traits.hpp
+++ b/daemon/fw/process-nack-traits.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,7 +31,7 @@
 namespace nfd {
 namespace fw {
 
-/** \brief provides a common procedure for processing Nacks
+/** \brief Provides a common procedure for processing Nacks
  *
  *  This procedure works as follows:
  *  1. If Nacks have been received from all upstream faces, return a Nack with least severe reason
@@ -44,7 +44,7 @@
  *
  *  To use this helper, the strategy should inherit from ProcessNackTraits<MyStrategy>,
  *  and declare that specialization as a friend class.
- *  Then, invoke processNack from afterReceiveNack trigger.
+ *  Then, invoke processNack() from the Strategy::afterReceiveNack() trigger.
  */
 class ProcessNackTraitsBase : noncopyable
 {
@@ -53,7 +53,7 @@
   ~ProcessNackTraitsBase() = default;
 
   void
-  processNack(const Face& inFace, const lp::Nack& nack,
+  processNack(const lp::Nack& nack, const Face& inFace,
               const shared_ptr<pit::Entry>& pitEntry);
 
 private:
@@ -81,14 +81,14 @@
   sendNackForProcessNackTraits(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
                                const lp::NackHeader& header) override
   {
-    m_strategy->sendNack(pitEntry, outFace, header);
+    m_strategy->sendNack(header, outFace, pitEntry);
   }
 
   void
   sendNacksForProcessNackTraits(const shared_ptr<pit::Entry>& pitEntry,
                                 const lp::NackHeader& header) override
   {
-    m_strategy->sendNacks(pitEntry, header);
+    m_strategy->sendNacks(header, pitEntry);
   }
 
 private:
diff --git a/daemon/fw/random-strategy.cpp b/daemon/fw/random-strategy.cpp
index 96b2ae7..2ab24c9 100644
--- a/daemon/fw/random-strategy.cpp
+++ b/daemon/fw/random-strategy.cpp
@@ -57,7 +57,7 @@
 }
 
 void
-RandomStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+RandomStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                      const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -71,20 +71,20 @@
 
     lp::NackHeader nackHeader;
     nackHeader.setReason(lp::NackReason::NO_ROUTE);
-    this->sendNack(pitEntry, ingress.face, nackHeader);
+    this->sendNack(nackHeader, ingress.face, pitEntry);
     this->rejectPendingInterest(pitEntry);
     return;
   }
 
   std::shuffle(nhs.begin(), nhs.end(), ndn::random::getRandomNumberEngine());
-  this->sendInterest(pitEntry, nhs.front().getFace(), interest);
+  this->sendInterest(interest, nhs.front().getFace(), pitEntry);
 }
 
 void
-RandomStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+RandomStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                                  const shared_ptr<pit::Entry>& pitEntry)
 {
-  this->processNack(ingress.face, nack, pitEntry);
+  this->processNack(nack, ingress.face, pitEntry);
 }
 
 } // namespace fw
diff --git a/daemon/fw/random-strategy.hpp b/daemon/fw/random-strategy.hpp
index 1aa170a..27b2041 100644
--- a/daemon/fw/random-strategy.hpp
+++ b/daemon/fw/random-strategy.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -46,12 +46,13 @@
   static const Name&
   getStrategyName();
 
+public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 3a4fcbb..80630dc 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -66,7 +66,7 @@
 }
 
 void
-SelfLearningStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+SelfLearningStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                            const shared_ptr<pit::Entry>& pitEntry)
 {
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -80,7 +80,7 @@
       NFD_LOG_DEBUG("NACK non-discovery Interest=" << interest << " from=" << ingress << " noNextHop");
       lp::NackHeader nackHeader;
       nackHeader.setReason(lp::NackReason::NO_ROUTE);
-      this->sendNack(pitEntry, ingress.face, nackHeader);
+      this->sendNack(nackHeader, ingress.face, pitEntry);
       this->rejectPendingInterest(pitEntry);
     }
     else { // multicast it if matching FIB entry exists
@@ -100,8 +100,8 @@
 }
 
 void
-SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                                       const FaceEndpoint& ingress, const Data& data)
+SelfLearningStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+                                       const shared_ptr<pit::Entry>& pitEntry)
 {
   auto outRecord = pitEntry->getOutRecord(ingress.face);
   if (outRecord == pitEntry->out_end()) {
@@ -112,7 +112,7 @@
   OutRecordInfo* outRecordInfo = outRecord->getStrategyInfo<OutRecordInfo>();
   if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
     if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
-      sendDataToAll(pitEntry, ingress.face, data);
+      sendDataToAll(data, pitEntry, ingress.face);
     }
     else { // needs a PA (to respond discovery Interest)
       asyncProcessData(pitEntry, ingress.face, data);
@@ -125,12 +125,12 @@
     }
     else { // Data contains no PrefixAnnouncement, upstreams do not support self-learning
     }
-    sendDataToAll(pitEntry, ingress.face, data);
+    sendDataToAll(data, pitEntry, ingress.face);
   }
 }
 
 void
-SelfLearningStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+SelfLearningStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                                        const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << ingress
@@ -138,7 +138,7 @@
   if (nack.getReason() == lp::NackReason::NO_ROUTE) { // remove FIB entries
     BOOST_ASSERT(this->lookupFib(*pitEntry).hasNextHops());
     NFD_LOG_DEBUG("Send NACK to all downstreams");
-    this->sendNacks(pitEntry, nack.getHeader());
+    this->sendNacks(nack.getHeader(), pitEntry);
     renewRoute(nack.getInterest().getName(), ingress.face.getId(), 0_ms);
   }
 }
@@ -156,7 +156,7 @@
 
     NFD_LOG_DEBUG("send discovery Interest=" << interest << " from=" << inFace.getId() <<
                   " to=" << outFace.getId());
-    auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+    auto outRecord = this->sendInterest(interest, outFace, pitEntry);
     if (outRecord != nullptr) {
       outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
     }
@@ -176,7 +176,7 @@
     Face& outFace = nexthop.getFace();
     NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from=" << inFace.getId() <<
                   " to=" << outFace.getId());
-    auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+    auto outRecord = this->sendInterest(interest, outFace, pitEntry);
     if (outRecord != nullptr) {
       outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
     }
@@ -201,7 +201,7 @@
             if (pitEntry && inFace) {
               NFD_LOG_DEBUG("found PrefixAnnouncement=" << pa.getAnnouncedName());
               data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
-              this->sendDataToAll(pitEntry, *inFace, data);
+              this->sendDataToAll(data, pitEntry, *inFace);
               this->setExpiryTimer(pitEntry, 0_ms);
             }
             else {
diff --git a/daemon/fw/self-learning-strategy.hpp b/daemon/fw/self-learning-strategy.hpp
index 7ffefc2..bb4f6f7 100644
--- a/daemon/fw/self-learning-strategy.hpp
+++ b/daemon/fw/self-learning-strategy.hpp
@@ -79,19 +79,18 @@
 
 public: // triggers
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const FaceEndpoint& ingress, const Data& data) override;
+  afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+                   const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry) override;
 
 private: // operations
-
   /** \brief Send an Interest to all possible faces
    *
    *  This function is invoked when the forwarder has no matching FIB entries for
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 3dc9abd..9cfb3be 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -136,7 +136,7 @@
   BOOST_ASSERT(strategyName.at(-1).isVersion());
 
   bool hasVersion = std::any_of(input.rbegin(), input.rend(),
-                                [] (const name::Component& comp) { return comp.isVersion(); });
+                                [] (const auto& comp) { return comp.isVersion(); });
   return hasVersion ? input : Name(input).append(strategyName.at(-1));
 }
 
@@ -151,59 +151,47 @@
 Strategy::~Strategy() = default;
 
 void
-Strategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                const FaceEndpoint& ingress, const Data& data)
+Strategy::afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+                               const shared_ptr<pit::Entry>& pitEntry)
+{
+  NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
+                << " in=" << ingress << " data=" << data.getName());
+
+  this->sendData(data, ingress.face, pitEntry);
+}
+
+void
+Strategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                                const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG("beforeSatisfyInterest pitEntry=" << pitEntry->getName()
                 << " in=" << ingress << " data=" << data.getName());
 }
 
 void
-Strategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                               const FaceEndpoint& ingress, const Data& data)
-{
-  NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
-                << " in=" << ingress << " data=" << data.getName());
-
-  this->sendData(pitEntry, data, ingress.face);
-}
-
-void
-Strategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                           const FaceEndpoint& ingress, const Data& data)
+Strategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+                           const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG("afterReceiveData pitEntry=" << pitEntry->getName()
                 << " in=" << ingress << " data=" << data.getName());
 
-  this->beforeSatisfyInterest(pitEntry, ingress, data);
-
-  this->sendDataToAll(pitEntry, ingress.face, data);
+  this->beforeSatisfyInterest(data, ingress, pitEntry);
+  this->sendDataToAll(data, pitEntry, ingress.face);
 }
 
 void
-Strategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack&,
+Strategy::afterReceiveNack(const lp::Nack&, const FaceEndpoint& ingress,
                            const shared_ptr<pit::Entry>& pitEntry)
 {
   NFD_LOG_DEBUG("afterReceiveNack in=" << ingress << " pitEntry=" << pitEntry->getName());
 }
 
 void
-Strategy::onDroppedInterest(const Face& egress, const Interest& interest)
+Strategy::onDroppedInterest(const Interest& interest, Face& egress)
 {
   NFD_LOG_DEBUG("onDroppedInterest out=" << egress.getId() << " name=" << interest.getName());
 }
 
-pit::OutRecord*
-Strategy::sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress, const Interest& interest)
-{
-  if (interest.getTag<lp::PitToken>() != nullptr) {
-    Interest interest2 = interest; // make a copy to preserve tag on original packet
-    interest2.removeTag<lp::PitToken>();
-    return m_forwarder.onOutgoingInterest(pitEntry, egress, interest2);
-  }
-  return m_forwarder.onOutgoingInterest(pitEntry, egress, interest);
-}
-
 void
 Strategy::afterNewNextHop(const fib::NextHop& nextHop, const shared_ptr<pit::Entry>& pitEntry)
 {
@@ -211,8 +199,19 @@
                 << " nexthop=" << nextHop.getFace().getId());
 }
 
+pit::OutRecord*
+Strategy::sendInterest(const Interest& interest, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
+{
+  if (interest.getTag<lp::PitToken>() != nullptr) {
+    Interest interest2 = interest; // make a copy to preserve tag on original packet
+    interest2.removeTag<lp::PitToken>();
+    return m_forwarder.onOutgoingInterest(interest2, egress, pitEntry);
+  }
+  return m_forwarder.onOutgoingInterest(interest, egress, pitEntry);
+}
+
 bool
-Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, Face& egress)
+Strategy::sendData(const Data& data, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
 {
   BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
 
@@ -235,14 +234,13 @@
 }
 
 void
-Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
-                        const Face& inFace, const Data& data)
+Strategy::sendDataToAll(const Data& data, const shared_ptr<pit::Entry>& pitEntry, const Face& inFace)
 {
   std::set<Face*> pendingDownstreams;
   auto now = time::steady_clock::now();
 
   // remember pending downstreams
-  for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
+  for (const auto& inRecord : pitEntry->getInRecords()) {
     if (inRecord.getExpiry() > now) {
       if (inRecord.getFace().getId() == inFace.getId() &&
           inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
@@ -253,27 +251,28 @@
   }
 
   for (const auto& pendingDownstream : pendingDownstreams) {
-    this->sendData(pitEntry, data, *pendingDownstream);
+    this->sendData(data, *pendingDownstream, pitEntry);
   }
 }
 
 void
-Strategy::sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
+Strategy::sendNacks(const lp::NackHeader& header, const shared_ptr<pit::Entry>& pitEntry,
                     std::initializer_list<const Face*> exceptFaces)
 {
   // populate downstreams with all downstreams faces
   std::unordered_set<Face*> downstreams;
-  std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
-                 [] (const pit::InRecord& inR) { return &inR.getFace(); });
+  std::transform(pitEntry->in_begin(), pitEntry->in_end(),
+                 std::inserter(downstreams, downstreams.end()),
+                 [] (const auto& inR) { return &inR.getFace(); });
 
-  // delete excluded faces
+  // remove excluded faces
   for (auto exceptFace : exceptFaces) {
     downstreams.erase(const_cast<Face*>(exceptFace));
   }
 
   // send Nacks
   for (auto downstream : downstreams) {
-    this->sendNack(pitEntry, *downstream, header);
+    this->sendNack(header, *downstream, pitEntry);
   }
   // warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
 }
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 3c6536e..93a154b 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -32,7 +32,8 @@
 namespace nfd {
 namespace fw {
 
-/** \brief Represents a forwarding strategy
+/**
+ * \brief Represents a forwarding strategy
  */
 class Strategy : noncopyable
 {
@@ -115,169 +116,193 @@
   }
 
 public: // triggers
-  /** \brief Trigger after Interest is received
+  /**
+   * \brief Trigger after an Interest is received.
    *
-   *  The Interest:
+   * The Interest:
    *  - has not exceeded HopLimit
    *  - does not violate Scope
    *  - is not looped
    *  - cannot be satisfied by ContentStore
    *  - is under a namespace managed by this strategy
    *
-   *  The PIT entry is set to expire after InterestLifetime has elapsed at each downstream.
+   * The PIT entry is set to expire after InterestLifetime has elapsed at each downstream.
    *
-   *  The strategy should decide whether and where to forward this Interest.
+   * The strategy should decide whether and where to forward this Interest.
    *  - If the strategy decides to forward this Interest,
-   *    invoke \c sendInterest for each upstream, either now or shortly after via a scheduler event,
-   *    but before PIT entry expires.
-   *    Optionally, the strategy can invoke \c setExpiryTimer to adjust how long it would wait for a response.
-   *  - If the strategy has already forwarded this Interest previously and decides to continue waiting,
-   *    do nothing.
-   *    Optionally, the strategy can invoke \c setExpiryTimer to adjust how long it would wait for a response.
+   *    invoke sendInterest() for each upstream, either now or shortly after via a scheduler event,
+   *    but before the PIT entry expires.
+   *    Optionally, the strategy can invoke setExpiryTimer() to adjust how long it would wait for a response.
+   *  - If the strategy has already forwarded this Interest previously and decides to continue
+   *    waiting, do nothing.
+   *    Optionally, the strategy can invoke setExpiryTimer() to adjust how long it would wait for a response.
    *  - If the strategy concludes that this Interest cannot be satisfied,
-   *    invoke \c rejectPendingInterest to erase the PIT entry.
+   *    invoke rejectPendingInterest() to erase the PIT entry.
    *
-   *  \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
-   *           may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
+   * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+   *          returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+   *          construct and keep a weak_ptr to \p pitEntry.
    */
   virtual void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) = 0;
 
-  /** \brief Trigger before PIT entry is satisfied
+  /**
+   * \brief Trigger after a matching Data is found in the Content Store.
    *
-   *  This trigger is invoked when an incoming Data satisfies more than one PIT entry.
-   *  The strategy can collect measurements information, but cannot manipulate Data forwarding.
-   *  When an incoming Data satisfies only one PIT entry, \c afterReceiveData is invoked instead
-   *  and given full control over Data forwarding. If a strategy does not override \c afterReceiveData,
-   *  the default implementation invokes \c beforeSatisfyInterest.
+   * In the base class, this method sends \p data to \p ingress.
    *
-   *  Normally, PIT entries would be erased after receiving the first matching Data.
-   *  If the strategy wishes to collect responses from additional upstream nodes,
-   *  it should invoke \c setExpiryTimer within this function to prolong the PIT entry lifetime.
-   *  If a Data arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again.
-   *  At that time, this function must invoke \c setExpiryTimer again to continue collecting more responses.
-   *
-   *  In this base class this method does nothing.
-   *
-   *  \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
-   *           may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
+   * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+   *          returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+   *          construct and keep a weak_ptr to \p pitEntry.
    */
   virtual void
-  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const FaceEndpoint& ingress, const Data& data);
+  afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+                       const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Trigger after a Data is matched in CS
+  /**
+   * \brief Trigger before a PIT entry is satisfied.
    *
-   *  In the base class this method sends \p data to \p ingress
+   * This trigger is invoked when an incoming Data satisfies more than one PIT entry.
+   * The strategy can collect measurements information, but cannot manipulate Data forwarding.
+   * When an incoming Data satisfies only one PIT entry, afterReceiveData() is invoked instead
+   * and given full control over Data forwarding. If a strategy does not override afterReceiveData(),
+   * the default implementation invokes beforeSatisfyInterest().
+   *
+   * Normally, PIT entries are erased after receiving the first matching Data.
+   * If the strategy wishes to collect responses from additional upstream nodes,
+   * it should invoke setExpiryTimer() within this function to prolong the PIT entry lifetime.
+   * If a Data arrives from another upstream during the extended PIT entry lifetime, this trigger
+   * will be invoked again. At that time, the strategy must invoke setExpiryTimer() again to
+   * continue collecting more responses.
+   *
+   * In the base class, this method does nothing.
+   *
+   * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+   *          returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+   *          construct and keep a weak_ptr to \p pitEntry.
    */
   virtual void
-  afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                       const FaceEndpoint& ingress, const Data& data);
+  beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                        const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Trigger after Data is received
+  /**
+   * \brief Trigger after Data is received.
    *
-   *  This trigger is invoked when an incoming Data satisfies exactly one PIT entry,
-   *  and gives the strategy full control over Data forwarding.
+   * This trigger is invoked when an incoming Data satisfies exactly one PIT entry,
+   * and gives the strategy full control over Data forwarding.
    *
-   *  When this trigger is invoked:
+   * When this trigger is invoked:
    *  - The Data has been verified to satisfy the PIT entry.
    *  - The PIT entry expiry timer is set to now
    *
-   *  Within this function:
-   *  - A strategy should return Data to downstream nodes via \c sendData or \c sendDataToAll.
+   * Inside this function:
+   *  - A strategy should return Data to downstream nodes via sendData() or sendDataToAll().
    *  - A strategy can modify the Data as long as it still satisfies the PIT entry, such as
    *    adding or removing congestion marks.
-   *  - A strategy can delay Data forwarding by prolonging the PIT entry lifetime via \c setExpiryTimer,
-   *    and forward Data before the PIT entry is erased.
+   *  - A strategy can delay Data forwarding by prolonging the PIT entry lifetime via setExpiryTimer(),
+   *    and later forward the Data before the PIT entry is erased.
    *  - A strategy can collect measurements about the upstream.
    *  - A strategy can collect responses from additional upstream nodes by prolonging the PIT entry
-   *    lifetime via \c setExpiryTimer every time a Data is received. Note that only one Data should
+   *    lifetime via setExpiryTimer() every time a Data is received. Note that only one Data should
    *    be returned to each downstream node.
    *
-   *  In the base class this method invokes \c beforeSatisfyInterest trigger and then returns
-   *  the Data to downstream faces via \c sendDataToAll.
+   * In the base class, this method invokes beforeSatisfyInterest() and then returns the Data
+   * to all downstream faces via sendDataToAll().
+   *
+   * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+   *          returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+   *          construct and keep a weak_ptr to \p pitEntry.
    */
   virtual void
-  afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                   const FaceEndpoint& ingress, const Data& data);
-
-  /** \brief Trigger after Nack is received
-   *
-   *  This trigger is invoked when an incoming Nack is received in response to
-   *  an forwarded Interest.
-   *  The Nack has been confirmed to be a response to the last Interest forwarded
-   *  to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
-   *  The NackHeader has been recorded in the PIT out-record.
-   *
-   *  If the PIT entry is not yet satisfied, its expiry timer remains unchanged.
-   *  Otherwise, the PIT entry normally would expire immediately after this function returns.
-   *
-   *  If the strategy wishes to collect responses from additional upstream nodes,
-   *  it should invoke \c setExpiryTimer within this function to retain the PIT entry.
-   *  If a Nack arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again.
-   *  At that time, this function must invoke \c setExpiryTimer again to continue collecting more responses.
-   *
-   *  In the base class this method does nothing.
-   *
-   *  \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
-   *           may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
-   */
-  virtual void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveData(const Data& data, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Trigger after Interest dropped (e.g., for exceeding allowed retransmissions)
+  /**
+   * \brief Trigger after a Nack is received.
    *
-   *  In the base class this method does nothing.
+   * This trigger is invoked when an incoming Nack is received in response to
+   * an forwarded Interest.
+   * The Nack has been confirmed to be a response to the last Interest forwarded
+   * to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
+   * The NackHeader has been recorded in the PIT out-record.
+   *
+   * If the PIT entry is not yet satisfied, its expiry timer remains unchanged.
+   * Otherwise, the PIT entry will normally expire immediately after this function returns.
+   *
+   * If the strategy wishes to collect responses from additional upstream nodes,
+   * it should invoke setExpiryTimer() within this function to prolong the PIT entry lifetime.
+   * If a Nack arrives from another upstream during the extended PIT entry lifetime, this trigger
+   * will be invoked again. At that time, the strategy must invoke setExpiryTimer() again to
+   * continue collecting more responses.
+   *
+   * In the base class, this method does nothing.
+   *
+   * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+   *          returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+   *          construct and keep a weak_ptr to \p pitEntry.
    */
   virtual void
-  onDroppedInterest(const Face& egress, const Interest& interest);
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
+                   const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Trigger after new nexthop is added
+  /**
+   * \brief Trigger after an Interest is dropped (e.g., for exceeding allowed retransmissions).
    *
-   *  The strategy should decide whether to send the buffered Interests to the new nexthop.
-   *  In the base class, this method does nothing.
+   * In the base class, this method does nothing.
+   */
+  virtual void
+  onDroppedInterest(const Interest& interest, Face& egress);
+
+  /**
+   * \brief Trigger after a new nexthop is added.
+   *
+   * The strategy should decide whether to send the buffered Interests to the new nexthop.
+   *
+   * In the base class, this method does nothing.
    */
   virtual void
   afterNewNextHop(const fib::NextHop& nextHop, const shared_ptr<pit::Entry>& pitEntry);
 
 protected: // actions
-  /** \brief Send an Interest packet.
-   *  \param pitEntry the PIT entry
-   *  \param egress face through which to send out the Interest
-   *  \param interest the Interest packet
-   *  \return A pointer to the out-record created or nullptr if the Interest was dropped
+  /**
+   * \brief Send an Interest packet.
+   * \param interest the Interest packet
+   * \param egress face through which to send out the Interest
+   * \param pitEntry the PIT entry
+   * \return A pointer to the out-record created or nullptr if the Interest was dropped
    */
   NFD_VIRTUAL_WITH_TESTS pit::OutRecord*
-  sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
-               const Interest& interest);
+  sendInterest(const Interest& interest, Face& egress, const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Send a Data packet.
-   *  \param pitEntry the PIT entry
-   *  \param data the Data packet
-   *  \param egress face through which to send out the Data
-   *  \return Whether the Data was sent (true) or dropped (false)
+  /**
+   * \brief Send a Data packet.
+   * \param data the Data packet
+   * \param egress face through which to send out the Data
+   * \param pitEntry the PIT entry
+   * \return Whether the Data was sent (true) or dropped (false)
    */
   NFD_VIRTUAL_WITH_TESTS bool
-  sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, Face& egress);
+  sendData(const Data& data, Face& egress, const shared_ptr<pit::Entry>& pitEntry);
 
-  /** \brief Send a Data packet to all matched and qualified faces.
+  /**
+   * \brief Send a Data packet to all matched and qualified faces.
    *
-   *  A matched face is qualified if it is ad-hoc or it is NOT \p inFace.
+   * A matched face qualifies if it is ad-hoc OR it is NOT \p inFace.
    *
-   *  \param pitEntry the PIT entry
-   *  \param inFace face on which the Data arrived
-   *  \param data the Data packet
+   * \param data the Data packet
+   * \param pitEntry the PIT entry
+   * \param inFace face on which the Data arrived
    */
   NFD_VIRTUAL_WITH_TESTS void
-  sendDataToAll(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace, const Data& data);
+  sendDataToAll(const Data& data, const shared_ptr<pit::Entry>& pitEntry, const Face& inFace);
 
-  /** \brief Schedule the PIT entry for immediate deletion.
+  /**
+   * \brief Schedule the PIT entry for immediate deletion.
    *
-   *  This helper function sets the PIT entry expiry time to zero.
-   *  The strategy should invoke this function when it concludes that the Interest cannot
-   *  be forwarded and it does not want to wait for responses from existing upstream nodes.
+   * This helper function sets the PIT entry expiry time to zero.
+   * The strategy should invoke this function when it concludes that the Interest cannot
+   * be forwarded and it does not want to wait for responses from existing upstream nodes.
    */
   NFD_VIRTUAL_WITH_TESTS void
   rejectPendingInterest(const shared_ptr<pit::Entry>& pitEntry)
@@ -285,33 +310,35 @@
     this->setExpiryTimer(pitEntry, 0_ms);
   }
 
-  /** \brief Send a Nack packet.
+  /**
+   * \brief Send a Nack packet.
    *
-   *  The egress face must have a PIT in-record, otherwise this method has no effect.
+   * The egress face must have a PIT in-record, otherwise this method has no effect.
    *
-   *  \param pitEntry the PIT entry
-   *  \param egress face through which to send out the Nack
-   *  \param header the Nack header
-   *  \return Whether the Nack was sent (true) or dropped (false)
+   * \param header the Nack header
+   * \param egress face through which to send out the Nack
+   * \param pitEntry the PIT entry
+   * \return Whether the Nack was sent (true) or dropped (false)
    */
   NFD_VIRTUAL_WITH_TESTS bool
-  sendNack(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
-           const lp::NackHeader& header)
+  sendNack(const lp::NackHeader& header, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
   {
-    return m_forwarder.onOutgoingNack(pitEntry, egress, header);
+    return m_forwarder.onOutgoingNack(header, egress, pitEntry);
   }
 
-  /** \brief Send Nack to every face that has an in-record, except those in \p exceptFaces
-   *  \param pitEntry the PIT entry
-   *  \param header the Nack header
-   *  \param exceptFaces list of faces that should be excluded from sending Nacks
-   *  \note This is not an action, but a helper that invokes the sendNack() action.
+  /**
+   * \brief Send Nack to every face that has an in-record, except those in \p exceptFaces
+   * \param header the Nack header
+   * \param pitEntry the PIT entry
+   * \param exceptFaces list of faces that should be excluded from sending Nacks
+   * \note This is not an action, but a helper that invokes the sendNack() action.
    */
   void
-  sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
+  sendNacks(const lp::NackHeader& header, const shared_ptr<pit::Entry>& pitEntry,
             std::initializer_list<const Face*> exceptFaces = {});
 
-  /** \brief Schedule the PIT entry to be erased after \p duration.
+  /**
+   * \brief Schedule the PIT entry to be erased after \p duration.
    */
   void
   setExpiryTimer(const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
@@ -320,7 +347,8 @@
   }
 
 protected: // accessors
-  /** \brief Performs a FIB lookup, considering Link object if present.
+  /**
+   * \brief Performs a FIB lookup, considering Link object if present.
    */
   const fib::Entry&
   lookupFib(const pit::Entry& pitEntry) const;
@@ -381,8 +409,8 @@
   }
 
 private: // registry
-  typedef std::function<unique_ptr<Strategy>(Forwarder& forwarder, const Name& strategyName)> CreateFunc;
-  typedef std::map<Name, CreateFunc> Registry; // indexed by strategy name
+  using CreateFunc = std::function<unique_ptr<Strategy>(Forwarder&, const Name& /*strategyName*/)>;
+  using Registry = std::map<Name, CreateFunc>; // indexed by strategy name
 
   static Registry&
   getRegistry();
@@ -396,13 +424,7 @@
 
 private: // instance fields
   Name m_name;
-
-  /** \brief Reference to the forwarder
-   *
-   *  Triggers can access forwarder indirectly via actions.
-   */
   Forwarder& m_forwarder;
-
   MeasurementsAccessor m_measurements;
 };
 
