diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 2b79a53..8215ade 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -82,7 +82,7 @@
   , m_isLocalhopEnabled(false)
   , m_remoteRegistrator(m_nfdController, m_keyChain, m_managedRib)
   , m_ribStatusPublisher(m_managedRib, face, LIST_COMMAND_PREFIX, m_keyChain)
-  , m_lastTransactionId(0)
+  , m_fibUpdater(m_managedRib, m_nfdController)
   , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
                          SIGNED_COMMAND_VERBS +
                          (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor)))
@@ -146,36 +146,33 @@
 {
   bool isRemoteRegisterEnabled = false;
 
-  for (ConfigSection::const_iterator i = configSection.begin();
-       i != configSection.end(); ++i)
-    {
-      if (i->first == "localhost_security")
-          m_localhostValidator.load(i->second, filename);
-      else if (i->first == "localhop_security")
-        {
-          m_localhopValidator.load(i->second, filename);
-          m_isLocalhopEnabled = true;
-        }
-      else if (i->first == "remote_register")
-        {
-          m_remoteRegistrator.loadConfig(i->second);
-          isRemoteRegisterEnabled = true;
-          // avoid other actions when isDryRun == true
-          if (isDryRun)
-            {
-              continue;
-            }
-
-          m_remoteRegistrator.enable();
-        }
-      else
-        throw Error("Unrecognized rib property: " + i->first);
+  for (const auto& item : configSection) {
+    if (item.first == "localhost_security") {
+      m_localhostValidator.load(item.second, filename);
     }
-
-  if (!isRemoteRegisterEnabled)
-    {
-      m_remoteRegistrator.disable();
+    else if (item.first == "localhop_security") {
+      m_localhopValidator.load(item.second, filename);
+      m_isLocalhopEnabled = true;
     }
+    else if (item.first == "remote_register") {
+      m_remoteRegistrator.loadConfig(item.second);
+      isRemoteRegisterEnabled = true;
+
+      // Avoid other actions when isDryRun == true
+      if (isDryRun) {
+        continue;
+      }
+
+      m_remoteRegistrator.enable();
+    }
+    else {
+      throw Error("Unrecognized rib property: " + item.first);
+    }
+  }
+
+  if (!isRemoteRegisterEnabled) {
+    m_remoteRegistrator.disable();
+  }
 }
 
 void
@@ -208,17 +205,15 @@
 
   UnsignedVerbDispatchTable::const_iterator unsignedVerbProcessor = m_unsignedVerbDispatch.find(verb);
 
-  if (unsignedVerbProcessor != m_unsignedVerbDispatch.end())
-    {
-      NFD_LOG_DEBUG("command result: processing unsigned verb: " << verb);
-      (unsignedVerbProcessor->second)(this, request);
-    }
-  else
-    {
-      m_localhostValidator.validate(request,
-                                    bind(&RibManager::onCommandValidated, this, _1),
-                                    bind(&RibManager::onCommandValidationFailed, this, _1, _2));
-    }
+  if (unsignedVerbProcessor != m_unsignedVerbDispatch.end()) {
+    NFD_LOG_DEBUG("command result: processing unsigned verb: " << verb);
+    (unsignedVerbProcessor->second)(this, request);
+  }
+  else {
+    m_localhostValidator.validate(request,
+                                  bind(&RibManager::onCommandValidated, this, _1),
+                                  bind(&RibManager::onCommandValidationFailed, this, _1, _2));
+  }
 }
 
 void
@@ -240,26 +235,30 @@
   const Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];
 
   SignedVerbDispatchTable::const_iterator verbProcessor = m_signedVerbDispatch.find(verb);
-  if (verbProcessor != m_signedVerbDispatch.end())
-    {
-      ControlParameters parameters;
-      if (!extractParameters(parameterComponent, parameters))
-        {
-          NFD_LOG_DEBUG("command result: malformed verb: " << verb);
-          if (static_cast<bool>(request))
-            sendResponse(command, 400, "Malformed command");
-          return;
-        }
 
-      NFD_LOG_DEBUG("command result: processing verb: " << verb);
-      (verbProcessor->second)(this, request, parameters);
+  if (verbProcessor != m_signedVerbDispatch.end()) {
+
+    ControlParameters parameters;
+    if (!extractParameters(parameterComponent, parameters)) {
+      NFD_LOG_DEBUG("command result: malformed verb: " << verb);
+
+      if (static_cast<bool>(request)) {
+        sendResponse(command, 400, "Malformed command");
+      }
+
+      return;
     }
-  else
-    {
-      NFD_LOG_DEBUG("Unsupported command: " << verb);
-      if (static_cast<bool>(request))
-        sendResponse(request->getName(), 501, "Unsupported command");
+
+    NFD_LOG_DEBUG("command result: processing verb: " << verb);
+    (verbProcessor->second)(this, request, parameters);
+  }
+  else {
+    NFD_LOG_DEBUG("Unsupported command: " << verb);
+
+    if (static_cast<bool>(request)) {
+      sendResponse(request->getName(), 501, "Unsupported command");
     }
+  }
 }
 
 void
@@ -268,23 +267,23 @@
 {
   ndn::nfd::RibRegisterCommand command;
 
-  if (!validateParameters(command, parameters))
-    {
-      NFD_LOG_DEBUG("register result: FAIL reason: malformed");
+  if (!validateParameters(command, parameters)) {
+    NFD_LOG_DEBUG("register result: FAIL reason: malformed");
 
-      if (static_cast<bool>(request))
-        {
-          sendResponse(request->getName(), 400, "Malformed command");
-        }
-
-      return;
+    if (static_cast<bool>(request)) {
+      sendResponse(request->getName(), 400, "Malformed command");
     }
 
+    return;
+  }
+
   bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
-  if (isSelfRegistration)
-    {
-      parameters.setFaceId(request->getIncomingFaceId());
-    }
+  if (isSelfRegistration) {
+    parameters.setFaceId(request->getIncomingFaceId());
+  }
+
+  // Respond since command is valid and authorized
+  sendSuccessResponse(request, parameters);
 
   Route route;
   route.faceId = parameters.getFaceId();
@@ -294,44 +293,37 @@
 
   if (parameters.hasExpirationPeriod() &&
       parameters.getExpirationPeriod() != time::milliseconds::max())
-    {
-      route.expires = time::steady_clock::now() + parameters.getExpirationPeriod();
+  {
+    route.expires = time::steady_clock::now() + parameters.getExpirationPeriod();
 
-      // Schedule a new event, the old one will be cancelled during rib insertion.
-      scheduler::EventId eventId = scheduler::schedule(parameters.getExpirationPeriod(),
-          bind(&RibManager::expireEntry, this, shared_ptr<Interest>(), parameters));
-      NFD_LOG_TRACE("Scheduled unregistration at: " << route.expires <<
-                    " with EventId: " << eventId);
+    // Schedule a new event, the old one will be cancelled during rib insertion.
+    scheduler::EventId eventId = scheduler::schedule(parameters.getExpirationPeriod(),
+      bind(&Rib::onRouteExpiration, &m_managedRib, parameters.getName(), route));
 
-      //set the  NewEventId of this entry
-      route.setExpirationEvent(eventId);
-    }
-  else
-    {
-      route.expires = time::steady_clock::TimePoint::max();
-    }
+    NFD_LOG_TRACE("Scheduled unregistration at: " << route.expires <<
+                  " with EventId: " << eventId);
+
+    // Set the  NewEventId of this entry
+    route.setExpirationEvent(eventId);
+  }
+  else {
+    route.expires = time::steady_clock::TimePoint::max();
+  }
 
   NFD_LOG_INFO("Adding route " << parameters.getName() << " nexthop=" << route.faceId
                                                        << " origin=" << route.origin
                                                        << " cost=" << route.cost);
 
-  m_managedRib.insert(parameters.getName(), route);
+  RibUpdate update;
+  update.setAction(RibUpdate::REGISTER)
+        .setName(parameters.getName())
+        .setRoute(route);
+
+  m_managedRib.beginApplyUpdate(update,
+                                bind(&RibManager::onRibUpdateSuccess, this, update),
+                                bind(&RibManager::onRibUpdateFailure, this, update, _1, _2));
+
   m_registeredFaces.insert(route.faceId);
-
-  sendUpdatesToFib(request, parameters);
-}
-
-void
-RibManager::expireEntry(const shared_ptr<const Interest>& request, ControlParameters& params)
-{
-  Route route;
-  route.faceId = params.getFaceId();
-  route.origin = params.getOrigin();
-  route.cost = params.getCost();
-  route.flags = params.getFlags();
-
-  NFD_LOG_DEBUG(route << " for " << params.getName() << " has expired");
-  unregisterEntry(request, params);
 }
 
 void
@@ -340,28 +332,36 @@
 {
   ndn::nfd::RibUnregisterCommand command;
 
-  //passing all parameters gives error in validation.
-  //so passing only the required arguments.
+  // Passing all parameters gives error in validation,
+  // so passing only the required arguments.
   ControlParameters parameters;
   parameters.setName(params.getName());
-  if (params.hasFaceId())
-    parameters.setFaceId(params.getFaceId());
-  if (params.hasOrigin())
-    parameters.setOrigin(params.getOrigin());
 
-  if (!validateParameters(command, parameters))
-    {
-      NFD_LOG_DEBUG("unregister result: FAIL reason: malformed");
-      if (static_cast<bool>(request))
-        sendResponse(request->getName(), 400, "Malformed command");
-      return;
+  if (params.hasFaceId()) {
+    parameters.setFaceId(params.getFaceId());
+  }
+
+  if (params.hasOrigin()) {
+    parameters.setOrigin(params.getOrigin());
+  }
+
+  if (!validateParameters(command, parameters)) {
+    NFD_LOG_DEBUG("unregister result: FAIL reason: malformed");
+
+    if (static_cast<bool>(request)) {
+      sendResponse(request->getName(), 400, "Malformed command");
     }
 
+    return;
+  }
+
   bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
-  if (isSelfRegistration)
-    {
-      parameters.setFaceId(request->getIncomingFaceId());
-    }
+  if (isSelfRegistration) {
+    parameters.setFaceId(request->getIncomingFaceId());
+  }
+
+  // Respond since command is valid and authorized
+  sendSuccessResponse(request, parameters);
 
   Route route;
   route.faceId = parameters.getFaceId();
@@ -370,9 +370,14 @@
   NFD_LOG_INFO("Removing route " << parameters.getName() << " nexthop=" << route.faceId
                                                          << " origin=" << route.origin);
 
-  m_managedRib.erase(parameters.getName(), route);
+  RibUpdate update;
+  update.setAction(RibUpdate::UNREGISTER)
+        .setName(parameters.getName())
+        .setRoute(route);
 
-  sendUpdatesToFib(request, parameters);
+  m_managedRib.beginApplyUpdate(update,
+                                bind(&RibManager::onRibUpdateSuccess, this, update),
+                                bind(&RibManager::onRibUpdateFailure, this, update, _1, _2));
 }
 
 void
@@ -380,8 +385,10 @@
                                       const std::string& failureInfo)
 {
   NFD_LOG_DEBUG("RibRequestValidationFailed: " << failureInfo);
-  if (static_cast<bool>(request))
+
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), 403, failureInfo);
+  }
 }
 
 
@@ -389,15 +396,13 @@
 RibManager::extractParameters(const Name::Component& parameterComponent,
                               ControlParameters& extractedParameters)
 {
-  try
-    {
-      Block rawParameters = parameterComponent.blockFromValue();
-      extractedParameters.wireDecode(rawParameters);
-    }
-  catch (const tlv::Error&)
-    {
-      return false;
-    }
+  try {
+    Block rawParameters = parameterComponent.blockFromValue();
+    extractedParameters.wireDecode(rawParameters);
+  }
+  catch (const tlv::Error&) {
+    return false;
+  }
 
   NFD_LOG_DEBUG("Parameters parsed OK");
   return true;
@@ -407,14 +412,12 @@
 RibManager::validateParameters(const ControlCommand& command,
                                ControlParameters& parameters)
 {
-  try
-    {
-      command.validateRequest(parameters);
-    }
-  catch (const ControlCommand::ArgumentError&)
-    {
-      return false;
-    }
+  try {
+    command.validateRequest(parameters);
+  }
+  catch (const ControlCommand::ArgumentError&) {
+    return false;
+  }
 
   command.applyDefaultsToRequest(parameters);
 
@@ -430,21 +433,20 @@
 
   ControlResponse response;
 
-  if (code == 404)
-    {
-      response.setCode(code);
-      response.setText(error);
-    }
-  else
-    {
-      response.setCode(533);
-      std::ostringstream os;
-      os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
-      response.setText(os.str());
-    }
+  if (code == 404) {
+    response.setCode(code);
+    response.setText(error);
+  }
+  else {
+    response.setCode(533);
+    std::ostringstream os;
+    os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
+    response.setText(os.str());
+  }
 
-  if (static_cast<bool>(request))
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), response);
+  }
 }
 
 void
@@ -460,8 +462,9 @@
 
   NFD_LOG_TRACE("onRegSuccess: registered " << route);
 
-  if (static_cast<bool>(request))
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), response);
+  }
 }
 
 
@@ -478,18 +481,18 @@
 
   NFD_LOG_TRACE("onUnRegSuccess: unregistered " << route);
 
-  if (static_cast<bool>(request))
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), response);
+  }
 }
 
 void
 RibManager::sendSuccessResponse(const shared_ptr<const Interest>& request,
                                 const ControlParameters& parameters)
 {
-  if (!static_cast<bool>(request))
-    {
-      return;
-    }
+  if (!static_cast<bool>(request)) {
+    return;
+  }
 
   ControlResponse response;
 
@@ -497,8 +500,9 @@
   response.setText("Success");
   response.setBody(parameters.wireEncode());
 
-  if (static_cast<bool>(request))
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), response);
+  }
 }
 
 void
@@ -507,28 +511,42 @@
 {
   NFD_LOG_ERROR("NFD returned an error: " << error << " (code: " << code << ")");
 
-  if (!static_cast<bool>(request))
-    {
-      return;
-    }
+  if (!static_cast<bool>(request)) {
+    return;
+  }
 
   ControlResponse response;
 
-  if (code == 404)
-    {
-      response.setCode(code);
-      response.setText(error);
-    }
-  else
-    {
-      response.setCode(533);
-      std::ostringstream os;
-      os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
-      response.setText(os.str());
-    }
+  if (code == 404) {
+    response.setCode(code);
+    response.setText(error);
+  }
+  else {
+    response.setCode(533);
+    std::ostringstream os;
+    os << "Failure to update NFD " << "(NFD Error: " << code << " " << error << ")";
+    response.setText(os.str());
+  }
 
-  if (static_cast<bool>(request))
+  if (static_cast<bool>(request)) {
     sendResponse(request->getName(), response);
+  }
+}
+
+void
+RibManager::onRibUpdateSuccess(const RibUpdate& update)
+{
+  NFD_LOG_DEBUG("RIB update succeeded for " << update);
+}
+
+void
+RibManager::onRibUpdateFailure(const RibUpdate& update, uint32_t code, const std::string& error)
+{
+  NFD_LOG_DEBUG("RIB update failed for " << update << " (code: " << code
+                                                   << ", error: " << error << ")");
+
+  // Since the FIB rejected the update, clean up invalid routes
+  scheduleActiveFaceFetch(time::seconds(1));
 }
 
 void
@@ -547,7 +565,6 @@
   m_managedRib.insert(prefix, route);
 
   m_registeredFaces.insert(route.faceId);
-  m_managedRib.clearFibUpdates();
 }
 
 void
@@ -556,92 +573,6 @@
   throw Error("Error in setting interest filter (" + name.toUri() + "): " + msg);
 }
 
-bool
-RibManager::isTransactionComplete(const TransactionId transactionId)
-{
-  FibTransactionTable::iterator it = m_pendingFibTransactions.find(transactionId);
-
-  if (it != m_pendingFibTransactions.end())
-    {
-      int& updatesLeft = it->second;
-
-      updatesLeft--;
-
-      // All of the updates have been applied successfully
-      if (updatesLeft == 0)
-        {
-          m_pendingFibTransactions.erase(it);
-          return true;
-        }
-    }
-
-    return false;
-}
-
-void
-RibManager::invalidateTransaction(const TransactionId transactionId)
-{
-  FibTransactionTable::iterator it = m_pendingFibTransactions.find(transactionId);
-
-  if (it != m_pendingFibTransactions.end())
-    {
-      m_pendingFibTransactions.erase(it);
-    }
-}
-
-void
-RibManager::onAddNextHopSuccess(const shared_ptr<const Interest>& request,
-                                const ControlParameters& parameters,
-                                const TransactionId transactionId,
-                                const bool shouldSendResponse)
-{
-  if (isTransactionComplete(transactionId) && shouldSendResponse)
-    {
-      sendSuccessResponse(request, parameters);
-    }
-}
-
-void
-RibManager::onAddNextHopError(uint32_t code, const std::string& error,
-                              const shared_ptr<const Interest>& request,
-                              const TransactionId transactionId, const bool shouldSendResponse)
-{
-  invalidateTransaction(transactionId);
-
-  if (shouldSendResponse)
-  {
-    sendErrorResponse(code, error, request);
-  }
-
-  // Since the FIB rejected the update, clean up the invalid face
-  scheduleActiveFaceFetch(time::seconds(1));
-}
-
-void
-RibManager::onRemoveNextHopSuccess(const shared_ptr<const Interest>& request,
-                                   const ControlParameters& parameters,
-                                   const TransactionId transactionId,
-                                   const bool shouldSendResponse)
-{
-  if (isTransactionComplete(transactionId) && shouldSendResponse)
-    {
-      sendSuccessResponse(request, parameters);
-    }
-}
-
-void
-RibManager::onRemoveNextHopError(uint32_t code, const std::string& error,
-                                 const shared_ptr<const Interest>& request,
-                                 const TransactionId transactionId, const bool shouldSendResponse)
-{
-  invalidateTransaction(transactionId);
-
-  if (shouldSendResponse)
-  {
-    sendErrorResponse(code, error, request);
-  }
-}
-
 void
 RibManager::onControlHeaderSuccess()
 {
@@ -672,111 +603,19 @@
 {
   NFD_LOG_TRACE("onNotification: " << notification);
 
-  if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED)
-    {
-      NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
+  if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) {
+    NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
 
-      scheduler::schedule(time::seconds(0),
-                          bind(&RibManager::processErasureAfterNotification, this,
-                               notification.getFaceId()));
-    }
+    scheduler::schedule(time::seconds(0),
+                        bind(&RibManager::onFaceDestroyedEvent, this, notification.getFaceId()));
+  }
 }
 
 void
-RibManager::processErasureAfterNotification(uint64_t faceId)
+RibManager::onFaceDestroyedEvent(uint64_t faceId)
 {
-  m_managedRib.erase(faceId);
+  m_managedRib.beginRemoveFace(faceId);
   m_registeredFaces.erase(faceId);
-
-  sendUpdatesToFibAfterFaceDestroyEvent();
-}
-
-void
-RibManager::sendUpdatesToFib(const shared_ptr<const Interest>& request,
-                             const ControlParameters& parameters)
-{
-  const Rib::FibUpdateList& updates = m_managedRib.getFibUpdates();
-
-  // If no updates were generated, consider the operation a success
-  if (updates.empty())
-    {
-      sendSuccessResponse(request, parameters);
-      return;
-    }
-
-  bool shouldWaitToRespond = false;
-
-  // An application request should wait for all FIB updates to be applied
-  // successfully before sending a response
-  if (parameters.getOrigin() == ndn::nfd::ROUTE_ORIGIN_APP)
-    {
-      shouldWaitToRespond = true;
-    }
-  else // Respond immediately
-    {
-      sendSuccessResponse(request, parameters);
-    }
-
-  std::string updateString = (updates.size() == 1) ? " update" : " updates";
-  NFD_LOG_DEBUG("Applying " << updates.size() << updateString << " to FIB");
-
-  // Assign an ID to this FIB transaction
-  TransactionId currentTransactionId = ++m_lastTransactionId;
-
-  // Add this transaction to the transaction table
-  m_pendingFibTransactions[currentTransactionId] = updates.size();
-
-  for (Rib::FibUpdateList::const_iterator it = updates.begin(); it != updates.end(); ++it)
-    {
-      shared_ptr<const FibUpdate> update(*it);
-      NFD_LOG_DEBUG("Sending FIB update: " << *update);
-
-      if (update->action == FibUpdate::ADD_NEXTHOP)
-        {
-          Route route;
-          route.faceId = update->faceId;
-          route.cost = update->cost;
-
-          m_nfdController.start<ndn::nfd::FibAddNextHopCommand>(
-            ControlParameters()
-              .setName(update->name)
-              .setFaceId(route.faceId)
-              .setCost(route.cost),
-            bind(&RibManager::onAddNextHopSuccess, this, request,
-                                                         parameters,
-                                                         currentTransactionId,
-                                                         shouldWaitToRespond),
-            bind(&RibManager::onAddNextHopError, this, _1, _2, request, currentTransactionId,
-                                                                        shouldWaitToRespond));
-        }
-      else if (update->action == FibUpdate::REMOVE_NEXTHOP)
-        {
-          Route route;
-          route.faceId = update->faceId;
-
-          m_nfdController.start<ndn::nfd::FibRemoveNextHopCommand>(
-            ControlParameters()
-              .setName(update->name)
-              .setFaceId(route.faceId),
-            bind(&RibManager::onRemoveNextHopSuccess, this, request,
-                                                            parameters,
-                                                            currentTransactionId,
-                                                            shouldWaitToRespond),
-            bind(&RibManager::onRemoveNextHopError, this, _1, _2, request, currentTransactionId,
-                                                                           shouldWaitToRespond));
-        }
-    }
-
-  m_managedRib.clearFibUpdates();
-}
-
-void
-RibManager::sendUpdatesToFibAfterFaceDestroyEvent()
-{
-  ControlParameters parameters;
-  parameters.setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC);
-
-  sendUpdatesToFib(shared_ptr<const Interest>(), parameters);
 }
 
 void
@@ -785,13 +624,12 @@
   const Name& command = request.getName();
   const size_t commandNComps = command.size();
 
-  if (commandNComps < LIST_COMMAND_NCOMPS ||
-      !LIST_COMMAND_PREFIX.isPrefixOf(command))
-    {
-      NFD_LOG_DEBUG("command result: malformed");
-      sendResponse(command, 400, "Malformed command");
-      return;
-    }
+  if (commandNComps < LIST_COMMAND_NCOMPS || !LIST_COMMAND_PREFIX.isPrefixOf(command)) {
+    NFD_LOG_DEBUG("command result: malformed");
+
+    sendResponse(command, 400, "Malformed command");
+    return;
+  }
 
   m_ribStatusPublisher.publish();
 }
@@ -830,16 +668,15 @@
   uint64_t currentSegment = data.getName().get(-1).toSegment();
 
   const name::Component& finalBlockId = data.getMetaInfo().getFinalBlockId();
-  if (finalBlockId.empty() || finalBlockId.toSegment() > currentSegment)
-    {
-      m_face.expressInterest(data.getName().getPrefix(-1).appendSegment(currentSegment+1),
-                             bind(&RibManager::fetchSegments, this, _2, buffer),
-                             bind(&RibManager::onFetchFaceStatusTimeout, this));
-    }
-  else
-    {
-      removeInvalidFaces(buffer);
-    }
+
+  if (finalBlockId.empty() || finalBlockId.toSegment() > currentSegment) {
+    m_face.expressInterest(data.getName().getPrefix(-1).appendSegment(currentSegment+1),
+                           bind(&RibManager::fetchSegments, this, _2, buffer),
+                           bind(&RibManager::onFetchFaceStatusTimeout, this));
+  }
+  else {
+    removeInvalidFaces(buffer);
+  }
 }
 
 void
@@ -869,15 +706,14 @@
 
   // Look for face IDs that were registered but not active to find missed
   // face destroyed events
-  for (FaceIdSet::iterator it = m_registeredFaces.begin(); it != m_registeredFaces.end(); ++it)
-    {
-      if (activeFaces.find(*it) == activeFaces.end())
-        {
-          NFD_LOG_DEBUG("Removing invalid face ID: " << *it);
-          scheduler::schedule(time::seconds(0),
-                              bind(&RibManager::processErasureAfterNotification, this, *it));
-        }
+  for (uint64_t faceId : m_registeredFaces) {
+    if (activeFaces.find(faceId) == activeFaces.end()) {
+      NFD_LOG_DEBUG("Removing invalid face ID: " << faceId);
+
+      scheduler::schedule(time::seconds(0),
+                          bind(&RibManager::onFaceDestroyedEvent, this, faceId));
     }
+  }
 
   // Reschedule the check for future clean up
   scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL);
