diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index f6d7d91..c13906a 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -218,13 +218,12 @@
       unregistrator = static_cast<Registrator>(&Controller::start<FibRemoveNextHopCommand>);
     }
 
-    RegisteredPrefix::Unregistrator bindedUnregistrator =
-        std::bind(unregistrator, m_face.m_nfdController, unregisterParameters, _1, _2,
+    RegisteredPrefix::Unregistrator boundUnregistrator =
+        bind(unregistrator, m_face.m_nfdController.get(), unregisterParameters, _1, _2,
                   options);
-    // @todo get rid of "std::" after #2109
 
     shared_ptr<RegisteredPrefix> prefixToRegister =
-      make_shared<RegisteredPrefix>(prefix, filter, bindedUnregistrator);
+      make_shared<RegisteredPrefix>(prefix, filter, boundUnregistrator);
 
     ((*m_face.m_nfdController).*registrator)(registerParameters,
                                              bind(&Impl::afterPrefixRegistered, this,
@@ -267,7 +266,6 @@
             // it was a combined operation
             m_interestFilterTable.remove(filter);
           }
-
         (*i)->unregister(bind(&Impl::finalizeUnregisterPrefix, this, i, onSuccess),
                          bind(onFailure, _2));
       }
diff --git a/src/face.cpp b/src/face.cpp
index 744ee0d..b36f955 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -39,7 +39,7 @@
   , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
-  construct(m_internalKeyChain);
+  construct(*m_internalKeyChain);
 }
 
 Face::Face(boost::asio::io_service& ioService)
@@ -48,7 +48,7 @@
   , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
-  construct(m_internalKeyChain);
+  construct(*m_internalKeyChain);
 }
 
 Face::Face(const std::string& host, const std::string& port/* = "6363"*/)
@@ -57,8 +57,7 @@
   , m_internalKeyChain(new KeyChain())
   , m_impl(new Impl(*this))
 {
-  construct(make_shared<TcpTransport>(host, port),
-            m_internalKeyChain);
+  construct(make_shared<TcpTransport>(host, port), *m_internalKeyChain);
 }
 
 Face::Face(const shared_ptr<Transport>& transport)
@@ -68,8 +67,7 @@
   , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
-  construct(transport,
-            m_internalKeyChain);
+  construct(transport, *m_internalKeyChain);
 }
 
 Face::Face(const shared_ptr<Transport>& transport,
@@ -79,8 +77,7 @@
   , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
-  construct(transport,
-            m_internalKeyChain);
+  construct(transport, *m_internalKeyChain);
 }
 
 Face::Face(shared_ptr<Transport> transport,
@@ -91,12 +88,11 @@
   , m_isDirectNfdFibManagementRequested(false)
   , m_impl(new Impl(*this))
 {
-  construct(transport,
-            &keyChain);
+  construct(transport, keyChain);
 }
 
 void
-Face::construct(KeyChain* keyChain)
+Face::construct(KeyChain& keyChain)
 {
   // transport=unix:///var/run/nfd.sock
   // transport=tcp://localhost:6363
@@ -121,7 +117,6 @@
       throw ConfigFile::Error(error.what());
     }
 
-  shared_ptr<Transport> transport;
   const std::string protocol = uri->getScheme();
 
   if (protocol == "unix")
@@ -140,10 +135,9 @@
 }
 
 void
-Face::construct(shared_ptr<Transport> transport,
-                KeyChain* keyChain)
+Face::construct(shared_ptr<Transport> transport, KeyChain& keyChain)
 {
-  m_nfdController = new nfd::Controller(*this, *keyChain);
+  m_nfdController.reset(new nfd::Controller(*this, keyChain));
 
   m_impl->m_pitTimeoutCheckTimerActive = false;
   m_transport = transport;
@@ -181,15 +175,7 @@
     }
 }
 
-Face::~Face()
-{
-  if (m_internalKeyChain != nullptr) {
-    delete m_internalKeyChain;
-  }
-
-  delete m_nfdController;
-  delete m_impl;
-}
+Face::~Face() = default;
 
 const PendingInterestId*
 Face::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
@@ -201,8 +187,7 @@
     throw Error("Interest size exceeds maximum limit");
 
   // If the same ioService thread, dispatch directly calls the method
-  m_ioService.dispatch(bind(&Impl::asyncExpressInterest, m_impl,
-                            interestToExpress, onData, onTimeout));
+  m_ioService.dispatch([=] { m_impl->asyncExpressInterest(interestToExpress, onData, onTimeout); });
 
   return reinterpret_cast<const PendingInterestId*>(interestToExpress.get());
 }
@@ -236,13 +221,13 @@
   }
 
   // If the same ioService thread, dispatch directly calls the method
-  m_ioService.dispatch(bind(&Impl::asyncPutData, m_impl, dataPtr));
+  m_ioService.dispatch([=] { m_impl->asyncPutData(dataPtr); });
 }
 
 void
 Face::removePendingInterest(const PendingInterestId* pendingInterestId)
 {
-  m_ioService.post(bind(&Impl::asyncRemovePendingInterest, m_impl, pendingInterestId));
+  m_ioService.post([=] { m_impl->asyncRemovePendingInterest(pendingInterestId); });
 }
 
 size_t
@@ -343,7 +328,7 @@
   shared_ptr<InterestFilterRecord> filter =
     make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
-  getIoService().post(bind(&Impl::asyncSetInterestFilter, m_impl, filter));
+  getIoService().post([=] { m_impl->asyncSetInterestFilter(filter); });
 
   return reinterpret_cast<const InterestFilterId*>(filter.get());
 }
@@ -386,14 +371,15 @@
 void
 Face::unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId)
 {
-  m_ioService.post(bind(&Impl::asyncUnregisterPrefix, m_impl, registeredPrefixId,
-                        UnregisterPrefixSuccessCallback(), UnregisterPrefixFailureCallback()));
+  m_ioService.post([=] { m_impl->asyncUnregisterPrefix(registeredPrefixId,
+                                                       UnregisterPrefixSuccessCallback(),
+                                                       UnregisterPrefixFailureCallback()); });
 }
 
 void
 Face::unsetInterestFilter(const InterestFilterId* interestFilterId)
 {
-  m_ioService.post(bind(&Impl::asyncUnsetInterestFilter, m_impl, interestFilterId));
+  m_ioService.post([=] { m_impl->asyncUnsetInterestFilter(interestFilterId); });
 }
 
 void
@@ -401,8 +387,7 @@
                        const UnregisterPrefixSuccessCallback& onSuccess,
                        const UnregisterPrefixFailureCallback& onFailure)
 {
-  m_ioService.post(bind(&Impl::asyncUnregisterPrefix, m_impl, registeredPrefixId,
-                        onSuccess, onFailure));
+  m_ioService.post([=] { m_impl->asyncUnregisterPrefix(registeredPrefixId,onSuccess, onFailure); });
 }
 
 void
@@ -449,7 +434,7 @@
 void
 Face::shutdown()
 {
-  m_ioService.post(bind(&Face::asyncShutdown, this));
+  m_ioService.post([this] { this->asyncShutdown(); });
 }
 
 void
diff --git a/src/face.hpp b/src/face.hpp
index 96fae40..d7399e8 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -540,15 +540,14 @@
    * @throws ConfigFile::Error on parse error and unsupported protocols
    */
   void
-  construct(KeyChain* keyChain);
+  construct(KeyChain& keyChain);
 
   /**
    * @throws Face::Error on unsupported protocol
    * @note shared_ptr is passed by value because ownership is transferred to this function
    */
   void
-  construct(shared_ptr<Transport> transport,
-            KeyChain* keyChain);
+  construct(shared_ptr<Transport> transport, KeyChain& keyChain);
 
   bool
   isSupportedNfdProtocol(const std::string& protocol);
@@ -583,13 +582,13 @@
    *        currently Face does not keep the KeyChain passed in constructor
    *        because it's not needed, but this may change in the future
    */
-  KeyChain* m_internalKeyChain;
+  unique_ptr<KeyChain> m_internalKeyChain;
 
-  nfd::Controller* m_nfdController;
+  unique_ptr<nfd::Controller> m_nfdController;
   bool m_isDirectNfdFibManagementRequested;
 
   class Impl;
-  Impl* m_impl;
+  unique_ptr<Impl> m_impl;
 };
 
 inline bool
