diff --git a/include/ndn-cpp-dev/common.hpp b/include/ndn-cpp-dev/common.hpp
index 59c49b5..a651a40 100644
--- a/include/ndn-cpp-dev/common.hpp
+++ b/include/ndn-cpp-dev/common.hpp
@@ -32,6 +32,7 @@
 
 // #if NDN_CPP_HAVE_BOOST_SHARED_PTR
 #include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
 #include <boost/make_shared.hpp>
 namespace ndn { namespace ptr_lib = boost; }
 
@@ -63,6 +64,7 @@
 (unset LANG; find . -type f -exec sed -i '' 's/ mpl_/ ndnboost_mpl_/g' {} +)
  */
 #include <ndnboost/shared_ptr.hpp>
+#include <ndnboost/enable_shared_from_this.hpp>
 #include <ndnboost/make_shared.hpp>
 namespace ndn { namespace ptr_lib = ndnboost; }
 
diff --git a/include/ndn-cpp-dev/face.hpp b/include/ndn-cpp-dev/face.hpp
index e006458..ec4fe27 100644
--- a/include/ndn-cpp-dev/face.hpp
+++ b/include/ndn-cpp-dev/face.hpp
@@ -20,22 +20,38 @@
 class Face {
 public:
   /**
-   * Create a new Face for communication with an NDN hub at host:port using the default TcpTransport.
-   * @param host The host of the NDN hub.
-   * @param port The port of the NDN hub. If omitted. use 6363.
+   * @brief Create a new Face for communication with an NDN hub using the default TcpTransport.
    */
   Face()
-  : node_(ptr_lib::shared_ptr<UnixTransport>(new UnixTransport()))
+    : node_(ptr_lib::shared_ptr<UnixTransport>(new UnixTransport()))
+  {
+  }
+
+  /**
+   * @brief Create a new Face for communication with an NDN hub using the default Transport.
+   * @param ioService A shared pointer to boost::io_service object that should control all IO operations
+   */
+  Face(const ptr_lib::shared_ptr<boost::asio::io_service> &ioService)
+    : node_(ptr_lib::shared_ptr<UnixTransport>(new UnixTransport()), ioService)
+  {
+  }
+  
+  /**
+   * Create a new Face for communication with an NDN hub with the given Transport object and connectionInfo.
+   * @param transport A shared_ptr to a Transport object used for communication.
+   */
+  Face(const ptr_lib::shared_ptr<Transport>& transport)
+    : node_(transport)
   {
   }
 
   /**
    * Create a new Face for communication with an NDN hub with the given Transport object and connectionInfo.
    * @param transport A shared_ptr to a Transport object used for communication.
-   * @param transport A shared_ptr to a Transport::ConnectionInfo to be used to connect to the transport.
+   * @param ioService A shared pointer to boost::io_service object that should control all IO operations
    */
-  Face(const ptr_lib::shared_ptr<Transport>& transport)
-  : node_(transport)
+  Face(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<boost::asio::io_service> &ioService)
+    : node_(transport, ioService)
   {
   }
   
@@ -56,10 +72,9 @@
    * use func_lib::ref() as appropriate.
    * @param onTimeout A function object to call if the interest times out.  If onTimeout is an empty OnTimeout(), this does not use it.
    * This copies the function object, so you may need to use func_lib::ref() as appropriate.
-   * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
    * @return The pending interest ID which can be used with removePendingInterest.
    */
-  uint64_t 
+  const PendingInterestId*
   expressInterest
     (const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
   {
@@ -72,13 +87,11 @@
    * @param name A reference to a Name for the interest.  This copies the Name.
    * @param interestTemplate if not 0, copy interest selectors from the template.   This does not keep a pointer to the Interest object.
    * @param onData A function object to call when a matching data packet is received.  This copies the function object, so you may need to
-   * use func_lib::ref() as appropriate.
+   *        use func_lib::ref() as appropriate.
    * @param onTimeout A function object to call if the interest times out.  If onTimeout is an empty OnTimeout(), this does not use it.
-   * This copies the function object, so you may need to use func_lib::ref() as appropriate.
-   * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
-   * @return The pending interest ID which can be used with removePendingInterest.
+   *        This copies the function object, so you may need to use func_lib::ref() as appropriate.
    */
-  uint64_t 
+  const PendingInterestId*
   expressInterest
     (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
 
@@ -93,7 +106,7 @@
    * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
    * @return The pending interest ID which can be used with removePendingInterest.
    */
-  uint64_t 
+  const PendingInterestId*
   expressInterest
     (const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout()) 
   {
@@ -107,7 +120,7 @@
    * @param pendingInterestId The ID returned from expressInterest.
    */
   void
-  removePendingInterest(uint64_t pendingInterestId)
+  removePendingInterest(const PendingInterestId* pendingInterestId)
   {
     node_.removePendingInterest(pendingInterestId);
   }
@@ -124,7 +137,7 @@
    * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
    * @return The registered prefix ID which can be used with removeRegisteredPrefix.
    */
-  uint64_t 
+  const RegisteredPrefixId*
   setInterestFilter
     (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags = ForwardingFlags())
   {
@@ -138,7 +151,7 @@
    * @param registeredPrefixId The ID returned from registerPrefix.
    */
   void
-  unsetInterestFilter(uint64_t registeredPrefixId)
+  unsetInterestFilter(const RegisteredPrefixId *registeredPrefixId)
   {
     node_.removeRegisteredPrefix(registeredPrefixId);
   }
diff --git a/include/ndn-cpp-dev/name.hpp b/include/ndn-cpp-dev/name.hpp
index ebac18f..1603618 100644
--- a/include/ndn-cpp-dev/name.hpp
+++ b/include/ndn-cpp-dev/name.hpp
@@ -21,7 +21,7 @@
 /**
  * A Name holds an array of Name::Component and represents an NDN name.
  */
-class Name {
+class Name : public ptr_lib::enable_shared_from_this<Name> {
 public:
   /**
    * A Name::Component holds a read-only name component value.
diff --git a/include/ndn-cpp-dev/node.hpp b/include/ndn-cpp-dev/node.hpp
index b5e4e97..7892075 100644
--- a/include/ndn-cpp-dev/node.hpp
+++ b/include/ndn-cpp-dev/node.hpp
@@ -14,9 +14,11 @@
 #include "forwarding-flags.hpp"
 #include "transport/transport.hpp"
 
-
 namespace ndn {
 
+struct PendingInterestId;
+struct RegisteredPrefixId;
+
 /**
  * An OnData function object is used to pass a callback to expressInterest.
  */
@@ -31,7 +33,7 @@
  * An OnInterest function object is used to pass a callback to registerPrefix.
  */
 typedef func_lib::function<void
-  (const ptr_lib::shared_ptr<const Name>&, const ptr_lib::shared_ptr<const Interest>&, Transport&, uint64_t)> OnInterest;
+  (const ptr_lib::shared_ptr<const Name>&, const ptr_lib::shared_ptr<const Interest>&)> OnInterest;
 
 /**
  * An OnRegisterFailed function object is used to report when registerPrefix fails.
@@ -75,7 +77,7 @@
    * @param wireFormat A WireFormat object used to encode the message.
    * @return The pending interest ID which can be used with removePendingInterest.
    */
-  uint64_t 
+  const PendingInterestId*
   expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
   
   /**
@@ -85,7 +87,7 @@
    * @param pendingInterestId The ID returned from expressInterest.
    */
   void
-  removePendingInterest(uint64_t pendingInterestId);
+  removePendingInterest(const PendingInterestId *pendingInterestId);
   
   /**
    * Register prefix with the connected NDN hub and call onInterest when a matching interest is received.
@@ -98,7 +100,7 @@
    * @param wireFormat A WireFormat object used to encode the message.
    * @return The registered prefix ID which can be used with removeRegisteredPrefix.
    */
-  uint64_t 
+  const RegisteredPrefixId*
   registerPrefix
     (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags);
 
@@ -109,7 +111,7 @@
    * @param registeredPrefixId The ID returned from registerPrefix.
    */
   void
-  removeRegisteredPrefix(uint64_t registeredPrefixId);
+  removeRegisteredPrefix(const RegisteredPrefixId *registeredPrefixId);
 
    /**
    * @brief Publish data packet
@@ -146,6 +148,13 @@
   shutdown();
 
 private:
+  void
+  asyncExpressInterest(const ptr_lib::shared_ptr<const Interest> &interest,
+                       const OnData& onData, const OnTimeout& onTimeout);
+
+  void
+  asyncRemovePendingInterest(const PendingInterestId *pendingInterestId);
+  
   void 
   onReceiveElement(const Block &wire);
 
@@ -158,30 +167,14 @@
   public:
     /**
      * Create a new PitEntry and set the timeoutTime_ based on the current time and the interest lifetime.
-     * @param pendingInterestId A unique ID for this entry, which you should get with getNextPendingInteresId().
      * @param interest A shared_ptr for the interest.
      * @param onData A function object to call when a matching data packet is received.
      * @param onTimeout A function object to call if the interest times out.  If onTimeout is an empty OnTimeout(), this does not use it.
      */
     PendingInterest
-      (uint64_t pendingInterestId, const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, 
+      (const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, 
        const OnTimeout& onTimeout);
     
-    /**
-     * Return the next unique pending interest ID.
-     */
-    static uint64_t 
-    getNextPendingInterestId()
-    {
-      return ++lastPendingInterestId_;
-    }
-    
-    /**
-     * Return the pendingInterestId given to the constructor.
-     */
-    uint64_t 
-    getPendingInterestId() { return pendingInterestId_; }
-    
     const ptr_lib::shared_ptr<const Interest>& 
     getInterest() { return interest_; }
     
@@ -206,9 +199,6 @@
     callTimeout();
     
   private:
-    static uint64_t lastPendingInterestId_; /**< A class variable used to get the next unique ID. */
-
-    uint64_t pendingInterestId_;            /**< A unique identifier for this entry so it can be deleted */
     ptr_lib::shared_ptr<const Interest> interest_;
     const OnData onData_;
     const OnTimeout onTimeout_;
@@ -216,58 +206,71 @@
     MillisecondsSince1970 timeoutTimeMilliseconds_; /**< The time when the interest times out in milliseconds according to ndn_getNowMilliseconds, or -1 for no timeout. */
   };
 
+  // Functor to match pending interests against PendingInterestId
+  struct MatchPendingInterestId
+  {
+    MatchPendingInterestId(const PendingInterestId *pendingInterestId)
+      : id_(pendingInterestId)
+    {
+    }
+
+    bool
+    operator()(const ptr_lib::shared_ptr<const PendingInterest> &pendingInterest) const
+    {
+      return (reinterpret_cast<const PendingInterestId *>(pendingInterest.get()) == id_);
+    }
+  private:
+    const PendingInterestId *id_;
+  };
+
+  
   class RegisteredPrefix {
   public:
     /**
      * Create a new PrefixEntry.
-     * @param registeredPrefixId A unique ID for this entry, which you should get with getNextRegisteredPrefixId().
      * @param prefix A shared_ptr for the prefix.
      * @param onInterest A function object to call when a matching data packet is received.
      */
-    RegisteredPrefix(uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest)
-      : registeredPrefixId_(registeredPrefixId)
-      , prefix_(prefix)
+    RegisteredPrefix(const Name& prefix, const OnInterest& onInterest)
+      : prefix_(new Name(prefix))
       , onInterest_(onInterest)
     {
     }
     
-    /**
-     * Return the next unique entry ID.
-     */
-    static uint64_t 
-    getNextRegisteredPrefixId()
+    const Name& 
+    getPrefix() const
     {
-      return ++lastRegisteredPrefixId_;
-    }
-    
-    /**
-     * Return the registeredPrefixId given to the constructor.
-     */
-    uint64_t 
-    getRegisteredPrefixId()
-    {
-      return registeredPrefixId_;
-    }
-    
-    const ptr_lib::shared_ptr<const Name>& 
-    getPrefix()
-    {
-      return prefix_;
+      return *prefix_;
     }
     
     const OnInterest& 
-    getOnInterest()
+    getOnInterest() const
     {
       return onInterest_;
     }
     
   private:
-    static uint64_t lastRegisteredPrefixId_; /**< A class variable used to get the next unique ID. */
-
-    uint64_t registeredPrefixId_;            /**< A unique identifier for this entry so it can be deleted */
-    ptr_lib::shared_ptr<const Name> prefix_;
+    ptr_lib::shared_ptr<Name> prefix_;
     const OnInterest onInterest_;
   };
+
+  // Functor to match pending interests against PendingInterestId
+  struct MatchRegisteredPrefixId
+  {
+    MatchRegisteredPrefixId(const RegisteredPrefixId *registeredPrefixId)
+      : id_(registeredPrefixId)
+    {
+    }
+
+    bool
+    operator()(const ptr_lib::shared_ptr<RegisteredPrefix> &registeredPrefix) const
+    {
+      return (reinterpret_cast<const RegisteredPrefixId *>(registeredPrefix.get()) == id_);
+    }
+  private:
+    const RegisteredPrefixId *id_;
+  };
+
   
   typedef std::vector<ptr_lib::shared_ptr<PendingInterest> > PendingInterestTable;
   typedef std::vector<ptr_lib::shared_ptr<RegisteredPrefix> > RegisteredPrefixTable;
@@ -300,7 +303,7 @@
    */  
   void 
   registerPrefixHelper
-    (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest, 
+    (const ptr_lib::shared_ptr<RegisteredPrefix> &prefixToRegister, 
      const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags);
 
   /**
@@ -309,9 +312,7 @@
    * This method actually sets entry in a local interest filter table
    */
   void
-  registerPrefixFinal(uint64_t registeredPrefixId,
-                      const ptr_lib::shared_ptr<const Name>& prefix,
-                      const OnInterest& onInterest,
+  registerPrefixFinal(const ptr_lib::shared_ptr<RegisteredPrefix> &prefixToRegister,
                       const OnRegisterFailed& onRegisterFailed,
                       const ptr_lib::shared_ptr<const Interest>&, const ptr_lib::shared_ptr<Data>&);
   
