diff --git a/daemon/face/face-endpoint.hpp b/daemon/face/face-endpoint.hpp
index 4d33634..366c743 100644
--- a/daemon/face/face-endpoint.hpp
+++ b/daemon/face/face-endpoint.hpp
@@ -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,
@@ -36,8 +36,8 @@
 class FaceEndpoint
 {
 public:
-  FaceEndpoint(const Face& face, EndpointId endpoint)
-    : face(const_cast<Face&>(face))
+  FaceEndpoint(Face& face, EndpointId endpoint)
+    : face(face)
     , endpoint(endpoint)
   {
   }
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index 0076f85..c91e78a 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -171,7 +171,16 @@
   getExpirationTime() const;
 
   const FaceCounters&
-  getCounters() const;
+  getCounters() const
+  {
+    return m_counters;
+  }
+
+  FaceCounters&
+  getCounters()
+  {
+    return m_counters;
+  }
 
   /**
    * \brief Get channel on which face was created (unicast) or the associated channel (multicast)
@@ -301,12 +310,6 @@
   return m_transport->getExpirationTime();
 }
 
-inline const FaceCounters&
-Face::getCounters() const
-{
-  return m_counters;
-}
-
 std::ostream&
 operator<<(std::ostream& os, const FaceLogHelper<Face>& flh);
 
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;
 };
 
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 78eb795..afe009f 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -275,7 +275,7 @@
   auto& pit = topo.getForwarder(nodeB).getPit();
   auto pitEntry = pit.insert(*interest).first;
 
-  topo.getForwarder(nodeB).onOutgoingInterest(pitEntry, linkBC->getFace(nodeB), *interest);
+  topo.getForwarder(nodeB).onOutgoingInterest(*interest, linkBC->getFace(nodeB), pitEntry);
   this->advanceClocks(time::milliseconds(100));
 
   interest->refreshNonce();
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index cd519b5..5066cca 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-strategy.t.cpp
@@ -88,7 +88,7 @@
   // first Interest goes to nexthop with lowest FIB cost,
   // however face1 is downstream so it cannot be used
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
 
@@ -100,7 +100,7 @@
   std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face4, *interest);
-    strategy.afterReceiveInterest(FaceEndpoint(*face4, 0), *interest, pitEntry);
+    strategy.afterReceiveInterest(*interest, FaceEndpoint(*face4, 0), pitEntry);
 
     size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
@@ -132,7 +132,7 @@
   for (int i = 0; i < 3; ++i) {
     this->advanceClocks(TICK, BestRouteStrategy::RETX_SUPPRESSION_MAX * 2);
     pitEntry->insertOrUpdateInRecord(*face5, *interest);
-    strategy.afterReceiveInterest(FaceEndpoint(*face5, 0), *interest, pitEntry);
+    strategy.afterReceiveInterest(*interest, FaceEndpoint(*face5, 0), pitEntry);
   }
   BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
   BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
diff --git a/tests/daemon/fw/dummy-strategy.cpp b/tests/daemon/fw/dummy-strategy.cpp
index 3a6e338..439efd1 100644
--- a/tests/daemon/fw/dummy-strategy.cpp
+++ b/tests/daemon/fw/dummy-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,
@@ -44,23 +44,18 @@
 
 DummyStrategy::DummyStrategy(Forwarder& forwarder, const Name& name)
   : Strategy(forwarder)
-  , afterReceiveInterest_count(0)
-  , beforeSatisfyInterest_count(0)
-  , afterContentStoreHit_count(0)
-  , afterReceiveData_count(0)
-  , afterReceiveNack_count(0)
 {
   this->setInstanceName(name);
 }
 
 void
-DummyStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+DummyStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint&,
                                     const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterReceiveInterest_count;
 
   if (interestOutFace != nullptr) {
-    this->sendInterest(pitEntry, *interestOutFace, interest);
+    this->sendInterest(interest, *interestOutFace, pitEntry);
   }
   else {
     this->rejectPendingInterest(pitEntry);
@@ -68,39 +63,39 @@
 }
 
 void
-DummyStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                                     const FaceEndpoint& ingress, const Data& data)
-{
-  ++beforeSatisfyInterest_count;
-
-  Strategy::beforeSatisfyInterest(pitEntry, ingress, data);
-}
-
-void
-DummyStrategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                                    const FaceEndpoint& ingress, const Data& data)
+DummyStrategy::afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+                                    const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterContentStoreHit_count;
 
-  Strategy::afterContentStoreHit(pitEntry, ingress, data);
+  Strategy::afterContentStoreHit(data, ingress, pitEntry);
 }
 
 void
-DummyStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
-                                const FaceEndpoint& ingress, const Data& data)
+DummyStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                                     const shared_ptr<pit::Entry>& pitEntry)
+{
+  ++beforeSatisfyInterest_count;
+
+  Strategy::beforeSatisfyInterest(data, ingress, pitEntry);
+}
+
+void
+DummyStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+                                const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterReceiveData_count;
 
-  Strategy::afterReceiveData(pitEntry, ingress, data);
+  Strategy::afterReceiveData(data, ingress, pitEntry);
 }
 
 void
-DummyStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+DummyStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                                 const shared_ptr<pit::Entry>& pitEntry)
 {
   ++afterReceiveNack_count;
 
-  Strategy::afterReceiveNack(ingress, nack, pitEntry);
+  Strategy::afterReceiveNack(nack, ingress, pitEntry);
 }
 
 void
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index aacc1e4..f24d990 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-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,
@@ -47,37 +47,39 @@
   static Name
   getStrategyName(uint64_t version = std::numeric_limits<uint64_t>::max());
 
-  /** \brief constructor
+  /**
+   * \brief Constructor
    *
-   *  \p name is recorded unchanged as \p getInstanceName() , and will not automatically
-   *  gain a version number when instantiated without a version number.
+   * \p name is recorded unchanged as getInstanceName(), and will not automatically
+   * gain a version number when instantiated without a version number.
    */
   explicit
   DummyStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
 
-  /** \brief after receive Interest trigger
+  /**
+   * \brief After receive Interest trigger
    *
-   *  If \p interestOutFace is not null, Interest is forwarded to that face and endpoint via send Interest action;
-   *  otherwise, reject pending Interest action is invoked.
+   * If interestOutFace is not null, \p interest is forwarded to that face;
+   * otherwise, rejectPendingInterest() is invoked.
    */
   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;
+  afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+                       const shared_ptr<pit::Entry>& pitEntry) override;
 
   void
-  afterContentStoreHit(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
-  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;
 
   void
@@ -97,11 +99,11 @@
   }
 
 public:
-  int afterReceiveInterest_count;
-  int beforeSatisfyInterest_count;
-  int afterContentStoreHit_count;
-  int afterReceiveData_count;
-  int afterReceiveNack_count;
+  int afterReceiveInterest_count = 0;
+  int afterContentStoreHit_count = 0;
+  int beforeSatisfyInterest_count = 0;
+  int afterReceiveData_count = 0;
+  int afterReceiveNack_count = 0;
 
   // a collection of names of PIT entries that afterNewNextHop() was called on
   std::vector<Name> afterNewNextHopCalls;
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index e3b3a19..12ced16 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -165,14 +165,14 @@
   pitA->insertOrUpdateInRecord(*face1, *interestA1);
 
   auto interestA2 = makeInterest("/A", false, nullopt, 1698);
-  auto outA2 = forwarder.onOutgoingInterest(pitA, *face2, *interestA2);
+  auto outA2 = forwarder.onOutgoingInterest(*interestA2, *face2, pitA);
   BOOST_REQUIRE(outA2 != nullptr);
   BOOST_CHECK_EQUAL(outA2->getLastNonce(), 1698);
 
   // This packet will be dropped because HopLimit=0
   auto interestA3 = makeInterest("/A", false, nullopt, 9876);
   interestA3->setHopLimit(0);
-  auto outA3 = forwarder.onOutgoingInterest(pitA, *face2, *interestA3);
+  auto outA3 = forwarder.onOutgoingInterest(*interestA3, *face2, pitA);
   BOOST_CHECK(outA3 == nullptr);
 
   BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
@@ -275,47 +275,47 @@
   // local face, /localhost: OK
   strategy.afterReceiveInterest_count = 0;
   auto i1 = makeInterest("/localhost/A1");
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
+  forwarder.onIncomingInterest(*i1, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // non-local face, /localhost: violate
   strategy.afterReceiveInterest_count = 0;
   auto i2 = makeInterest("/localhost/A2");
-  forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
+  forwarder.onIncomingInterest(*i2, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 0);
 
   // local face, non-/localhost: OK
   strategy.afterReceiveInterest_count = 0;
   auto i3 = makeInterest("/A3");
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
+  forwarder.onIncomingInterest(*i3, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // non-local face, non-/localhost: OK
   strategy.afterReceiveInterest_count = 0;
   auto i4 = makeInterest("/A4");
-  forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
+  forwarder.onIncomingInterest(*i4, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
 
   // local face, /localhost: OK
   auto d1 = makeData("/localhost/B1");
-  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
+  forwarder.onIncomingData(*d1, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
 
   // non-local face, /localhost: violate
   auto d2 = makeData("/localhost/B2");
-  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
+  forwarder.onIncomingData(*d2, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
 
   // local face, non-/localhost: OK
   auto d3 = makeData("/B3");
-  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d3);
+  forwarder.onIncomingData(*d3, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 2);
 
   // non-local face, non-/localhost: OK
   auto d4 = makeData("/B4");
-  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d4);
+  forwarder.onIncomingData(*d4, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 3);
 }
 
@@ -330,31 +330,31 @@
   auto interest1 = makeInterest("/A/1");
   strategyA.afterReceiveInterest_count = 0;
   strategyA.interestOutFace = face2;
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest1);
+  forwarder.onIncomingInterest(*interest1, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
 
   auto interest2 = makeInterest("/B/2", true);
   strategyB.afterReceiveInterest_count = 0;
   strategyB.interestOutFace = face2;
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest2);
+  forwarder.onIncomingInterest(*interest2, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
 
   this->advanceClocks(1_ms, 5_ms);
 
   auto data1 = makeData("/A/1");
   strategyA.beforeSatisfyInterest_count = 0;
-  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data1);
+  forwarder.onIncomingData(*data1, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
 
   auto data2 = makeData("/B/2/b");
   strategyB.beforeSatisfyInterest_count = 0;
-  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
+  forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
 
   auto interest3 = makeInterest("/A/3", false, 30_ms);
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest3);
+  forwarder.onIncomingInterest(*interest3, FaceEndpoint(*face1, 0));
   auto interest4 = makeInterest("/B/4", false, 5_s);
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest4);
+  forwarder.onIncomingInterest(*interest4, FaceEndpoint(*face1, 0));
 }
 
 BOOST_AUTO_TEST_CASE(IncomingData)
@@ -378,7 +378,7 @@
   pitC->insertOrUpdateInRecord(*face4, *interestC);
 
   auto dataD = makeData("/A/B/C/D");
-  forwarder.onIncomingData(FaceEndpoint(*face3, 0), *dataD);
+  forwarder.onIncomingData(*dataD, FaceEndpoint(*face3, 0));
   this->advanceClocks(1_ms, 5_ms);
 
   BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
@@ -446,14 +446,14 @@
   auto nack1 = makeNack(*interest1, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack1);
+  forwarder.onIncomingNack(nack1, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
   auto nack2 = makeNack(*interest2, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack2);
+  forwarder.onIncomingNack(nack2, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
 
@@ -467,7 +467,7 @@
   auto nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, nullopt, 243), lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack3);
+  forwarder.onIncomingNack(nack3, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -479,7 +479,7 @@
   auto nack4a = makeNack(*interest4, lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face2, 0), nack4a);
+  forwarder.onIncomingNack(nack4a, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -487,7 +487,7 @@
   auto nack4b = makeNack(*makeInterest("/Etab4KpY", false, nullopt, 294), lp::NackReason::CONGESTION);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack4b);
+  forwarder.onIncomingNack(nack4b, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 
@@ -495,7 +495,7 @@
   pit4->insertOrUpdateOutRecord(*face3, *interest4);
   strategyA.afterReceiveNack_count = 0;
   strategyB.afterReceiveNack_count = 0;
-  forwarder.onIncomingNack(FaceEndpoint(*face3, 0), nack4a);
+  forwarder.onIncomingNack(nack4a, FaceEndpoint(*face3, 0));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
 }
@@ -522,7 +522,7 @@
   pit1->insertOrUpdateInRecord(*face1, *interest1);
 
   face2->sentNacks.clear();
-  BOOST_CHECK(!forwarder.onOutgoingNack(pit1, *face2, nackHeader));
+  BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face2, pit1));
   BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
 
   // send Nack with correct Nonce
@@ -534,7 +534,7 @@
   face1->sentNacks.clear();
   face2->sentNacks.clear();
 
-  BOOST_CHECK(forwarder.onOutgoingNack(pit2, *face1, nackHeader));
+  BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face1, pit2));
   BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
   BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
@@ -545,7 +545,7 @@
   BOOST_CHECK(inRecord2a == pit2->in_end());
 
   // send Nack with correct Nonce
-  BOOST_CHECK(forwarder.onOutgoingNack(pit2, *face2, nackHeader));
+  BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face2, pit2));
   BOOST_CHECK_EQUAL(face1->sentNacks.size(), 1);
   BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
@@ -560,7 +560,7 @@
   pit2->insertOrUpdateInRecord(*face3, *interest2c);
 
   face3->sentNacks.clear();
-  BOOST_CHECK(!forwarder.onOutgoingNack(pit2, *face3, nackHeader));
+  BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face3, pit2));
   BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
 
   // don't send Nack to face with invalid ID
@@ -568,7 +568,7 @@
   pit1->insertOrUpdateInRecord(*face4, *interest1b);
 
   face4->sentNacks.clear();
-  BOOST_CHECK(!forwarder.onOutgoingNack(pit1, *face4, nackHeader));
+  BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face4, pit1));
   BOOST_CHECK_EQUAL(face4->sentNacks.size(), 0);
 }
 
@@ -643,7 +643,6 @@
   // interest should be forwarded only once, as long as Nonce is in Dead Nonce List
   BOOST_ASSERT(25_ms * 40 < forwarder.getDeadNonceList().getLifetime());
   this->advanceClocks(25_ms, 40);
-
   BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
 
   // It's unnecessary to check that Interest with duplicate Nonce can be forwarded again
@@ -658,12 +657,12 @@
   auto face1 = addFace();
   auto interest = makeInterest("/hcLSAsQ9A", false, 2_s, 61883075);
 
-  DeadNonceList& dnl = forwarder.getDeadNonceList();
+  auto& dnl = forwarder.getDeadNonceList();
   dnl.add(interest->getName(), interest->getNonce());
-  Pit& pit = forwarder.getPit();
-  BOOST_REQUIRE_EQUAL(pit.size(), 0);
+  auto& pit = forwarder.getPit();
+  BOOST_CHECK_EQUAL(pit.size(), 0);
 
-  forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest);
+  forwarder.onIncomingInterest(*interest, FaceEndpoint(*face1, 0));
   this->advanceClocks(100_ms, 20_s);
   BOOST_CHECK_EQUAL(pit.size(), 0);
 }
@@ -674,7 +673,7 @@
   auto data = makeData("/A");
 
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
-  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data);
+  forwarder.onIncomingData(*data, FaceEndpoint(*face1, 0));
   this->advanceClocks(1_ms, 10_ms);
   BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
 }
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index a75bf30..90e4b1e 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -87,7 +87,7 @@
   auto pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
 
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
 
@@ -98,7 +98,7 @@
   pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face2, *interest);
 
-  strategy.afterReceiveInterest(FaceEndpoint(*face2, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
   // Since the interest is the same as the one sent out earlier, the PIT entry should not be
   // rejected, as any data coming back must be able to satisfy the original interest from face 1
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
@@ -164,7 +164,7 @@
   auto pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face3, *interest);
 
-  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
   BOOST_TEST(didSendInterestTo(*face1));
@@ -180,7 +180,7 @@
   std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face3, *interest);
-    strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+    strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
 
     size_t nSent = strategy.sendInterestHistory.size();
     if (nSent > nSentLast) {
@@ -208,7 +208,7 @@
   auto pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
 
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
 }
@@ -228,7 +228,7 @@
   auto interest = makeInterest("/t8ZiSOi3");
   auto pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
 
   // forwarded to faces 2 and 3
   BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -243,7 +243,7 @@
   interest->refreshNonce();
   pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face2, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face2, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
 
   // forwarded only to face 1, suppressed on face 3
   BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -257,7 +257,7 @@
   interest->refreshNonce();
   pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face3, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
 
   // suppressed on face 1, forwarded on face 2 (and suppression window doubles)
   BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -271,7 +271,7 @@
   interest->refreshNonce();
   pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face3, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
 
   // forwarded only to face 1, suppressed on face 2
   BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -285,7 +285,7 @@
   interest->refreshNonce();
   pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
 
   // forwarded to faces 2 and 3
   BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -304,7 +304,7 @@
   auto pitEntry = pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest);
 
-  strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+  strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
   BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
   BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
 
@@ -492,12 +492,12 @@
   auto interest = makeInterest("ndn:/localhop/H0D6i5fc");
   auto pitEntry = this->pit.insert(*interest).first;
   pitEntry->insertOrUpdateInRecord(*this->inFace1, *interest);
-  this->strategy.afterReceiveInterest(FaceEndpoint(*this->inFace1, 0), *interest, pitEntry);
+  this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->inFace1, 0), pitEntry);
 
   if (this->inFace2 != nullptr) {
     auto interest2 = makeInterest("ndn:/localhop/H0D6i5fc");
     pitEntry->insertOrUpdateInRecord(*this->inFace2, *interest2);
-    this->strategy.afterReceiveInterest(FaceEndpoint(*this->inFace2, 0), *interest2, pitEntry);
+    this->strategy.afterReceiveInterest(*interest2, FaceEndpoint(*this->inFace2, 0), pitEntry);
   }
 
   this->strategy.sendInterestHistory.clear();
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index 4b5345e..099d031 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -62,10 +62,10 @@
   }
 
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override
   {
-    DummyStrategy::afterReceiveInterest(ingress, interest, pitEntry);
+    DummyStrategy::afterReceiveInterest(interest, ingress, pitEntry);
 
     if (afterReceiveInterest_count <= 1) {
       setExpiryTimer(pitEntry, 190_ms);
@@ -73,10 +73,21 @@
   }
 
   void
-  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
-                        const FaceEndpoint& ingress, const Data& data) override
+  afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+                       const shared_ptr<pit::Entry>& pitEntry) override
   {
-    DummyStrategy::beforeSatisfyInterest(pitEntry, ingress, data);
+    if (afterContentStoreHit_count == 0) {
+      setExpiryTimer(pitEntry, 190_ms);
+    }
+
+    DummyStrategy::afterContentStoreHit(data, ingress, pitEntry);
+  }
+
+  void
+  beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+                        const shared_ptr<pit::Entry>& pitEntry) override
+  {
+    DummyStrategy::beforeSatisfyInterest(data, ingress, pitEntry);
 
     if (beforeSatisfyInterest_count <= 2) {
       setExpiryTimer(pitEntry, 190_ms);
@@ -84,19 +95,8 @@
   }
 
   void
-  afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
-                       const FaceEndpoint& ingress, const Data& data) override
-  {
-    if (afterContentStoreHit_count == 0) {
-      setExpiryTimer(pitEntry, 190_ms);
-    }
-
-    DummyStrategy::afterContentStoreHit(pitEntry, ingress, data);
-  }
-
-  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
   {
     ++afterReceiveData_count;
 
@@ -104,14 +104,14 @@
       setExpiryTimer(pitEntry, 290_ms);
     }
 
-    this->sendDataToAll(pitEntry, ingress.face, data);
+    this->sendDataToAll(data, pitEntry, ingress.face);
   }
 
   void
-  afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+  afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
                    const shared_ptr<pit::Entry>& pitEntry) override
   {
-    DummyStrategy::afterReceiveNack(ingress, nack, pitEntry);
+    DummyStrategy::afterReceiveNack(nack, ingress, pitEntry);
 
     if (afterReceiveNack_count <= 1) {
       setExpiryTimer(pitEntry, 50_ms);
diff --git a/tests/daemon/fw/random-strategy.t.cpp b/tests/daemon/fw/random-strategy.t.cpp
index 4822e4c..d2291c5 100644
--- a/tests/daemon/fw/random-strategy.t.cpp
+++ b/tests/daemon/fw/random-strategy.t.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,
@@ -78,22 +78,22 @@
 
   // Send 1000 Interests
   for (int i = 0; i < 1000; ++i) {
-    shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA" + std::to_string(i));
-    shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
+    auto interest = makeInterest("ndn:/BzgFBchqA" + std::to_string(i));
+    auto pitEntry = pit.insert(*interest).first;
 
     pitEntry->insertOrUpdateInRecord(*face1, *interest);
-    strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+    strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
   }
 
-  // Map outFaceId -> SentInterests.
-  std::unordered_map<int, int> faceInterestMap;
+  // Map outFaceId -> SentInterests
+  std::unordered_map<FaceId, int> faceInterestMap;
   for (const auto& i : strategy.sendInterestHistory) {
     faceInterestMap[i.outFaceId]++;
   }
 
   // Check that all faces received at least 10 Interest
   for (const auto& x : faceInterestMap) {
-    BOOST_CHECK_GE(x.second, 10);
+    BOOST_TEST(x.second >= 10);
   }
 }
 
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 5811652..9b5f588 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -108,7 +108,7 @@
   pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
 
   auto f = [&] {
-    this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
+    this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
   };
   BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
 
@@ -144,7 +144,7 @@
 
   lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
   pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
-  this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
+  this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
 
   BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
 
@@ -152,7 +152,7 @@
   pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
 
   auto f = [&] {
-    this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
+    this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
   };
   BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo));
 
@@ -186,7 +186,7 @@
 
   lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
   pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
-  this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
+  this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
 
   BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
 }
@@ -333,13 +333,13 @@
 
   lp::Nack nack3 = makeNack(*interest1, Combination::getX());
   pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
-  strategy.afterReceiveNack(FaceEndpoint(*face3, 0), nack3, pitEntry);
+  strategy.afterReceiveNack(nack3, FaceEndpoint(*face3, 0), pitEntry);
 
   BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
 
   lp::Nack nack4 = makeNack(*interest1, Combination::getY());
   pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
-  strategy.afterReceiveNack(FaceEndpoint(*face4, 0), nack4, pitEntry);
+  strategy.afterReceiveNack(nack4, FaceEndpoint(*face4, 0), pitEntry);
 
   BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
   BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest.wireEncode(),
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 93a6367..cec64c4 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -165,7 +165,7 @@
   pitEntry->insertOrUpdateInRecord(*this->face1, *interest);
 
   auto f = [&] {
-    this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry);
+    this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->face1, 0), pitEntry);
   };
   BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
 
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 5c6c552..6fd052e 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -128,7 +128,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
     this->limitedIo));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -147,7 +147,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
     this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -170,7 +170,7 @@
   pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
     this->limitedIo));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -190,7 +190,7 @@
   pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
     this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -213,7 +213,7 @@
   pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
+    [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
     this->limitedIo));
 
   BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -236,7 +236,7 @@
   pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
     this->limitedIo, T::canProcessNack()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -261,7 +261,7 @@
   pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
 
   BOOST_REQUIRE(this->strategy.waitForAction(
-    [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
+    [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
     this->limitedIo, T::canProcessNack()));
 
   BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index b9ed2ff..03c2f77 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -103,8 +103,8 @@
 
 protected:
   pit::OutRecord*
-  sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
-               const Interest& interest) override
+  sendInterest(const Interest& interest, Face& egress,
+               const shared_ptr<pit::Entry>& pitEntry) override
   {
     sendInterestHistory.push_back({pitEntry->getInterest(), egress.getId(), interest});
     auto it = pitEntry->insertOrUpdateOutRecord(egress, interest);
@@ -121,8 +121,8 @@
   }
 
   bool
-  sendNack(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
-           const lp::NackHeader& header) override
+  sendNack(const lp::NackHeader& header, Face& egress,
+           const shared_ptr<pit::Entry>& pitEntry) override
   {
     sendNackHistory.push_back({pitEntry->getInterest(), egress.getId(), header});
     pitEntry->deleteInRecord(egress);
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 21894ca..bc95d4f 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.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,
@@ -94,18 +94,18 @@
 template<typename Policy, bool shouldAdmitLocal, bool shouldAdmitNonLocal>
 struct FaceScopePolicyTest
 {
-  typedef Policy PolicyType;
-  typedef std::integral_constant<bool, shouldAdmitLocal> ShouldAdmitLocal;
-  typedef std::integral_constant<bool, shouldAdmitNonLocal> ShouldAdmitNonLocal;
+  using PolicyType = Policy;
+  using ShouldAdmitLocal = std::integral_constant<bool, shouldAdmitLocal>;
+  using ShouldAdmitNonLocal = std::integral_constant<bool, shouldAdmitNonLocal>;
 };
 
-typedef boost::mpl::vector<
+using FaceScopePolicyTests = boost::mpl::vector<
   FaceScopePolicyTest<void, false, false>, // default policy
   FaceScopePolicyTest<DropAllUnsolicitedDataPolicy, false, false>,
   FaceScopePolicyTest<AdmitLocalUnsolicitedDataPolicy, true, false>,
   FaceScopePolicyTest<AdmitNetworkUnsolicitedDataPolicy, false, true>,
   FaceScopePolicyTest<AdmitAllUnsolicitedDataPolicy, true, true>
-> FaceScopePolicyTests;
+>;
 
 BOOST_AUTO_TEST_CASE_TEMPLATE(FaceScopePolicy, T, FaceScopePolicyTests)
 {
@@ -115,16 +115,16 @@
                                       ndn::nfd::FACE_SCOPE_LOCAL);
   faceTable.add(face1);
 
-  shared_ptr<Data> data1 = makeData("/unsolicited-from-local");
-  forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data1);
+  auto data1 = makeData("/unsolicited-from-local");
+  forwarder.onIncomingData(*data1, FaceEndpoint(*face1, 0));
   BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
 
   auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
                                       ndn::nfd::FACE_SCOPE_NON_LOCAL);
   faceTable.add(face2);
 
-  shared_ptr<Data> data2 = makeData("/unsolicited-from-non-local");
-  forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
+  auto data2 = makeData("/unsolicited-from-non-local");
+  forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
   BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
 }
 
diff --git a/tests/other/fw/congestion-mark-strategy.cpp b/tests/other/fw/congestion-mark-strategy.cpp
index 71afcbc..d21fc6f 100644
--- a/tests/other/fw/congestion-mark-strategy.cpp
+++ b/tests/other/fw/congestion-mark-strategy.cpp
@@ -77,17 +77,17 @@
 }
 
 void
-CongestionMarkStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+CongestionMarkStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                                              const shared_ptr<pit::Entry>& pitEntry)
 {
   auto mark = interest.getCongestionMark();
   if (mark != m_congestionMark && (!m_shouldPreserveMark || mark == 0)) {
     Interest markedInterest(interest);
     markedInterest.setCongestionMark(m_congestionMark);
-    BestRouteStrategy::afterReceiveInterest(ingress, markedInterest, pitEntry);
+    BestRouteStrategy::afterReceiveInterest(markedInterest, ingress, pitEntry);
   }
   else {
-    BestRouteStrategy::afterReceiveInterest(ingress, interest, pitEntry);
+    BestRouteStrategy::afterReceiveInterest(interest, ingress, pitEntry);
   }
 }
 
diff --git a/tests/other/fw/congestion-mark-strategy.hpp b/tests/other/fw/congestion-mark-strategy.hpp
index 57c1bbe..9b0f982 100644
--- a/tests/other/fw/congestion-mark-strategy.hpp
+++ b/tests/other/fw/congestion-mark-strategy.hpp
@@ -50,7 +50,7 @@
   getStrategyName();
 
   void
-  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
                        const shared_ptr<pit::Entry>& pitEntry) override;
 
 private:
