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;
 };
 
 /**
