diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index c13906a..cb5b3bc 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -196,40 +196,17 @@
   {
     using namespace nfd;
 
-    typedef void (Controller::*Registrator)
-      (const ControlParameters&,
-       const Controller::CommandSucceedCallback&,
-       const Controller::CommandFailCallback&,
-       const CommandOptions&);
+    ControlParameters params;
+    params.setName(prefix);
+    params.setFlags(flags);
 
-    ControlParameters registerParameters, unregisterParameters;
-    registerParameters.setName(prefix);
-    unregisterParameters.setName(prefix);
+    auto prefixToRegister = make_shared<RegisteredPrefix>(prefix, filter, options);
 
-    Registrator registrator, unregistrator;
-    if (!m_face.m_isDirectNfdFibManagementRequested) {
-      registrator = static_cast<Registrator>(&Controller::start<RibRegisterCommand>);
-      unregistrator = static_cast<Registrator>(&Controller::start<RibUnregisterCommand>);
-
-      registerParameters.setFlags(flags);
-    }
-    else {
-      registrator = static_cast<Registrator>(&Controller::start<FibAddNextHopCommand>);
-      unregistrator = static_cast<Registrator>(&Controller::start<FibRemoveNextHopCommand>);
-    }
-
-    RegisteredPrefix::Unregistrator boundUnregistrator =
-        bind(unregistrator, m_face.m_nfdController.get(), unregisterParameters, _1, _2,
-                  options);
-
-    shared_ptr<RegisteredPrefix> prefixToRegister =
-      make_shared<RegisteredPrefix>(prefix, filter, boundUnregistrator);
-
-    ((*m_face.m_nfdController).*registrator)(registerParameters,
-                                             bind(&Impl::afterPrefixRegistered, this,
-                                                  prefixToRegister, onSuccess),
-                                             bind(onFailure, prefixToRegister->getPrefix(), _2),
-                                             options);
+    m_face.m_nfdController->start<RibRegisterCommand>(params,
+                                                      bind(&Impl::afterPrefixRegistered, this,
+                                                           prefixToRegister, onSuccess),
+                                                      bind(onFailure, prefixToRegister->getPrefix(), _2),
+                                                      options);
 
     return reinterpret_cast<const RegisteredPrefixId*>(prefixToRegister.get());
   }
@@ -255,22 +232,29 @@
                         const UnregisterPrefixSuccessCallback& onSuccess,
                         const UnregisterPrefixFailureCallback& onFailure)
   {
-    RegisteredPrefixTable::iterator i = std::find_if(m_registeredPrefixTable.begin(),
-                                                     m_registeredPrefixTable.end(),
-                                                     MatchRegisteredPrefixId(registeredPrefixId));
-    if (i != m_registeredPrefixTable.end())
-      {
-        const shared_ptr<InterestFilterRecord>& filter = (*i)->getFilter();
-        if (static_cast<bool>(filter))
-          {
-            // it was a combined operation
-            m_interestFilterTable.remove(filter);
-          }
-        (*i)->unregister(bind(&Impl::finalizeUnregisterPrefix, this, i, onSuccess),
-                         bind(onFailure, _2));
+    using namespace nfd;
+    auto i = std::find_if(m_registeredPrefixTable.begin(),
+                          m_registeredPrefixTable.end(),
+                          MatchRegisteredPrefixId(registeredPrefixId));
+    if (i != m_registeredPrefixTable.end()) {
+      RegisteredPrefix& record = **i;
+
+      const shared_ptr<InterestFilterRecord>& filter = record.getFilter();
+
+      if (filter != nullptr) {
+        // it was a combined operation
+        m_interestFilterTable.remove(filter);
       }
+
+      ControlParameters params;
+      params.setName(record.getPrefix());
+      m_face.m_nfdController->start<RibUnregisterCommand>(params,
+                                                          bind(&Impl::finalizeUnregisterPrefix, this, i, onSuccess),
+                                                          bind(onFailure, _2),
+                                                          record.getCommandOptions());
+    }
     else {
-      if (static_cast<bool>(onFailure)) {
+      if (onFailure != nullptr) {
         onFailure("Unrecognized PrefixId");
       }
     }
diff --git a/src/detail/registered-prefix.hpp b/src/detail/registered-prefix.hpp
index cfa3983..6e9beb4 100644
--- a/src/detail/registered-prefix.hpp
+++ b/src/detail/registered-prefix.hpp
@@ -27,13 +27,11 @@
 #include "../interest.hpp"
 
 #include "interest-filter-record.hpp"
+#include "management/nfd-command-options.hpp"
+#include "management/nfd-control-parameters.hpp"
 
 namespace ndn {
 
-namespace nfd {
-class ControlParameters;
-}
-
 class RegisteredPrefix : noncopyable
 {
 public:
@@ -45,23 +43,12 @@
    */
   typedef function<void(uint32_t/*code*/,const std::string&/*reason*/)> FailureCallback;
 
-  /// @brief Function that should be called to unregister prefix
-  typedef function<void(const SuccessCallback& onSuccess,
-                        const FailureCallback& onFailure)> Unregistrator;
-
-  RegisteredPrefix(const Name& prefix,
-                   const Unregistrator& unregistrator)
-    : m_prefix(prefix)
-    , m_unregistrator(unregistrator)
-  {
-  }
-
   RegisteredPrefix(const Name& prefix,
                    const shared_ptr<InterestFilterRecord>& filter,
-                   const Unregistrator& unregistrator)
+                   const nfd::CommandOptions& options)
     : m_prefix(prefix)
     , m_filter(filter)
-    , m_unregistrator(unregistrator)
+    , m_options(options)
   {
   }
 
@@ -77,19 +64,16 @@
     return m_filter;
   }
 
-  void
-  unregister(const SuccessCallback& onSuccess,
-             const FailureCallback& onFailure)
+  const nfd::CommandOptions&
+  getCommandOptions() const
   {
-    if (static_cast<bool>(m_unregistrator)) {
-      m_unregistrator(onSuccess, onFailure);
-    }
+    return m_options;
   }
 
 private:
   Name m_prefix;
   shared_ptr<InterestFilterRecord> m_filter;
-  Unregistrator m_unregistrator;
+  nfd::CommandOptions m_options;
 };
 
 /**
diff --git a/src/face.cpp b/src/face.cpp
index b36f955..3722fda 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -36,7 +36,6 @@
   : m_internalIoService(new boost::asio::io_service())
   , m_ioService(*m_internalIoService)
   , m_internalKeyChain(new KeyChain())
-  , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
   construct(*m_internalKeyChain);
@@ -45,7 +44,6 @@
 Face::Face(boost::asio::io_service& ioService)
   : m_ioService(ioService)
   , m_internalKeyChain(new KeyChain())
-  , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
   construct(*m_internalKeyChain);
@@ -64,7 +62,6 @@
   : m_internalIoService(new boost::asio::io_service())
   , m_ioService(*m_internalIoService)
   , m_internalKeyChain(new KeyChain())
-  , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
   construct(transport, *m_internalKeyChain);
@@ -74,7 +71,6 @@
            boost::asio::io_service& ioService)
   : m_ioService(ioService)
   , m_internalKeyChain(new KeyChain())
-  , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
   construct(transport, *m_internalKeyChain);
@@ -85,7 +81,6 @@
            KeyChain& keyChain)
   : m_ioService(ioService)
   , m_internalKeyChain(nullptr)
-  , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
   construct(transport, keyChain);
@@ -145,34 +140,6 @@
   m_impl->m_pitTimeoutCheckTimer      = make_shared<monotonic_deadline_timer>(ref(m_ioService));
   m_impl->m_processEventsTimeoutTimer = make_shared<monotonic_deadline_timer>(ref(m_ioService));
   m_impl->ensureConnected(false);
-
-  std::string protocol = "nrd-0.1";
-
-  try
-    {
-      protocol = m_impl->m_config.getParsedConfiguration().get<std::string>("protocol");
-    }
-  catch (boost::property_tree::ptree_bad_path& error)
-    {
-      // protocol not specified
-    }
-  catch (boost::property_tree::ptree_bad_data& error)
-    {
-      throw ConfigFile::Error(error.what());
-    }
-
-  if (isSupportedNrdProtocol(protocol))
-    {
-      // do nothing
-    }
-  else if (isSupportedNfdProtocol(protocol))
-    {
-      m_isDirectNfdFibManagementRequested = true;
-    }
-  else
-    {
-      throw Face::Error("Cannot create controller for unsupported protocol \"" + protocol + "\"");
-    }
 }
 
 Face::~Face() = default;
diff --git a/src/face.hpp b/src/face.hpp
index d7399e8..47e841e 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -247,7 +247,7 @@
    * @param onInterest     A callback to be called when a matching interest is received
    * @param onSuccess      A callback to be called when prefixRegister command succeeds
    * @param onFailure      A callback to be called when prefixRegister command fails
-   * @param flags          (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags          (optional) RIB flags
    * @param certificate    (optional) A certificate under which the prefix registration
    *                       command is signed.  When omitted, a default certificate of
    *                       the default identity is used to sign the registration command
@@ -280,7 +280,7 @@
    * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
    * @param onInterest     A callback to be called when a matching interest is received
    * @param onFailure      A callback to be called when prefixRegister command fails
-   * @param flags          (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags          (optional) RIB flags
    * @param certificate    (optional) A certificate under which the prefix registration
    *                       command is signed.  When omitted, a default certificate of
    *                       the default identity is used to sign the registration command
@@ -315,7 +315,7 @@
    * @param onFailure      A callback to be called when prefixRegister command fails
    * @param identity       A signing identity. A prefix registration command is signed
    *                       under the default certificate of this identity
-   * @param flags          (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags          (optional) RIB flags
    *
    * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
    */
@@ -342,7 +342,7 @@
    * @param onFailure      A callback to be called when prefixRegister command fails
    * @param identity       A signing identity. A prefix registration command is signed
    *                       under the default certificate of this identity
-   * @param flags          (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags          (optional) RIB flags
    *
    * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
    */
@@ -373,7 +373,7 @@
   /**
    * @brief Register prefix with the connected NDN forwarder
    *
-   * This method only modifies forwarder's RIB (or FIB) and does not associate any
+   * This method only modifies forwarder's RIB and does not associate any
    * onInterest callbacks.  Use setInterestFilter method to dispatch incoming Interests to
    * the right callbacks.
    *
@@ -383,7 +383,7 @@
    * @param certificate (optional) A certificate under which the prefix registration
    *                    command is signed.  When omitted, a default certificate of
    *                    the default identity is used to sign the registration command
-   * @param flags       (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags       (optional) RIB flags
    *
    * @return The registered prefix ID which can be used with unregisterPrefix
    *
@@ -402,7 +402,7 @@
    * @brief Register prefix with the connected NDN forwarder and call onInterest when a matching
    *        interest is received.
    *
-   * This method only modifies forwarder's RIB (or FIB) and does not associate any
+   * This method only modifies forwarder's RIB and does not associate any
    * onInterest callbacks.  Use setInterestFilter method to dispatch incoming Interests to
    * the right callbacks.
    *
@@ -411,7 +411,7 @@
    * @param onFailure A callback to be called when prefixRegister command fails
    * @param identity  A signing identity. A prefix registration command is signed
    *                  under the default certificate of this identity
-   * @param flags     (optional) RIB flags (not used when direct FIB management is requested)
+   * @param flags     (optional) RIB flags
    *
    * @return The registered prefix ID which can be used with unregisterPrefix
    */
@@ -449,7 +449,7 @@
   unsetInterestFilter(const InterestFilterId* interestFilterId);
 
   /**
-   * @brief Deregister prefix from RIB (or FIB)
+   * @brief Unregister prefix from RIB
    *
    * unregisterPrefix will use the same credentials as original
    * setInterestFilter/registerPrefix command
@@ -466,12 +466,6 @@
                    const UnregisterPrefixSuccessCallback& onSuccess,
                    const UnregisterPrefixFailureCallback& onFailure);
 
-  /**
-   * @brief (FOR DEBUG PURPOSES ONLY) Request direct NFD FIB management
-   */
-  void
-  setDirectFibManagement(bool isDirectFibManagementRequested = false);
-
    /**
    * @brief Publish data packet
    *
@@ -549,12 +543,6 @@
   void
   construct(shared_ptr<Transport> transport, KeyChain& keyChain);
 
-  bool
-  isSupportedNfdProtocol(const std::string& protocol);
-
-  bool
-  isSupportedNrdProtocol(const std::string& protocol);
-
   class ProcessEventsTimeout
   {
   };
@@ -585,30 +573,11 @@
   unique_ptr<KeyChain> m_internalKeyChain;
 
   unique_ptr<nfd::Controller> m_nfdController;
-  bool m_isDirectNfdFibManagementRequested;
 
   class Impl;
   unique_ptr<Impl> m_impl;
 };
 
-inline bool
-Face::isSupportedNfdProtocol(const std::string& protocol)
-{
-  return protocol == "nfd-0.1";
-}
-
-inline bool
-Face::isSupportedNrdProtocol(const std::string& protocol)
-{
-  return protocol == "nrd-0.1";
-}
-
-inline void
-Face::setDirectFibManagement(bool isDirectFibManagementRequested/* = false*/)
-{
-  m_isDirectNfdFibManagementRequested = isDirectFibManagementRequested;
-}
-
 } // namespace ndn
 
 #endif // NDN_FACE_HPP
