diff --git a/Makefile.am b/Makefile.am
index d6ae92b..375b49a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -125,7 +125,6 @@
   src/security/policy/self-verify-policy-manager.cpp \
   src/security/security-exception.cpp \
   src/security/signature/sha256-with-rsa-handler.cpp \
-  src/transport/transport.cpp \
   src/transport/unix-transport.cpp \
   src/util/blob-stream.hpp \
   src/util/blob.cpp \
@@ -135,6 +134,7 @@
   src/util/dynamic-uint8-vector.hpp \
   src/util/logging.cpp \
   src/util/logging.hpp \
+  src/util/ndnd-id-fetcher.hpp \
   src/util/string-helper.hpp
 
 libndn_cpp_la_LIBADD  = @OPENSSL_LIBS@ @OSX_SECURITY_LIBS@
diff --git a/include/ndn-cpp/face.hpp b/include/ndn-cpp/face.hpp
index a0b3f0e..c7e0826 100644
--- a/include/ndn-cpp/face.hpp
+++ b/include/ndn-cpp/face.hpp
@@ -9,7 +9,8 @@
 #define NDN_FACE_HPP
 
 #include "node.hpp"
-#include "transport/tcp-transport.hpp"
+#include "transport/transport.hpp"
+#include "transport/unix-transport.hpp"
 
 namespace ndn {
 
@@ -19,6 +20,16 @@
 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.
+   */
+  Face()
+  : node_(ptr_lib::shared_ptr<UnixTransport>(new UnixTransport()))
+  {
+  }
+
+  /**
    * 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.
@@ -33,10 +44,10 @@
    * @param host The host of the NDN hub.
    * @param port The port of the NDN hub. If omitted. use 6363.
    */
-  Face(const char *host, unsigned short port = 6363)
-  : node_(ptr_lib::shared_ptr<TcpTransport>(new TcpTransport(host, port)))
-  {
-  }
+  // Face(const char *host, unsigned short port = 6363)
+  // : node_(ptr_lib::shared_ptr<TcpTransport>(new TcpTransport(host, port)))
+  // {
+  // }
     
   /**
    * Send the Interest through the transport, read the entire response and call onData(interest, data).
@@ -50,10 +61,9 @@
    */
   uint64_t 
   expressInterest
-    (const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
-     WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+    (const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
   {
-    return node_.expressInterest(interest, onData, onTimeout, wireFormat);
+    return node_.expressInterest(interest, onData, onTimeout);
   }
 
   /**
@@ -70,8 +80,7 @@
    */
   uint64_t 
   expressInterest
-    (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
-     WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
+    (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
 
   /**
    * Encode name as an Interest, using a default interest lifetime.
@@ -86,10 +95,9 @@
    */
   uint64_t 
   expressInterest
-    (const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
-     WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) 
+    (const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout()) 
   {
-    return expressInterest(name, 0, onData, onTimeout, wireFormat);
+    return expressInterest(name, 0, onData, onTimeout);
   }
 
   /**
@@ -118,10 +126,9 @@
    */
   uint64_t 
   setInterestFilter
-    (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags = ForwardingFlags(), 
-     WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
+    (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags = ForwardingFlags())
   {
-    return node_.registerPrefix(prefix, onInterest, onRegisterFailed, flags, wireFormat);
+    return node_.registerPrefix(prefix, onInterest, onRegisterFailed, flags);
   }
 
   /**
diff --git a/include/ndn-cpp/node.hpp b/include/ndn-cpp/node.hpp
index c68372d..3c43480 100644
--- a/include/ndn-cpp/node.hpp
+++ b/include/ndn-cpp/node.hpp
@@ -11,11 +11,9 @@
 #include "common.hpp"
 #include "interest.hpp"
 #include "data.hpp"
-#include "transport/tcp-transport.hpp"
 #include "forwarding-flags.hpp"
-#include "encoding/element-listener.hpp"
+#include "transport/transport.hpp"
 
-struct ndn_Interest;
 
 namespace ndn {
 
@@ -41,9 +39,8 @@
 typedef func_lib::function<void(const ptr_lib::shared_ptr<const Name>&)> OnRegisterFailed;
 
 class Face;
-class KeyChain;
     
-class Node : public ElementListener {
+class Node {
 public:
   /**
    * Create a new Node for communication with an NDN hub with the given Transport object and connectionInfo.
@@ -63,7 +60,7 @@
    * @return The pending interest ID which can be used with removePendingInterest.
    */
   uint64_t 
-  expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout, WireFormat& wireFormat);
+  expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
   
   /**
    * Remove the pending interest entry with the pendingInterestId from the pending interest table.
@@ -87,8 +84,7 @@
    */
   uint64_t 
   registerPrefix
-    (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, 
-     WireFormat& wireFormat);
+    (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags);
 
   /**
    * Remove the registered prefix entry with the registeredPrefixId from the pending interest table.  
@@ -113,12 +109,13 @@
   getTransport() { return transport_; }
   
   void 
-  onReceivedElement(const uint8_t *element, size_t elementLength);
-  
-  void 
   shutdown();
 
 private:
+  void 
+  onReceiveElement(const Block &wire);
+
+private:
   class PendingInterest {
   public:
     /**
@@ -154,20 +151,6 @@
     getOnData() { return onData_; }
     
     /**
-     * Get the struct ndn_Interest for the interest_.
-     * WARNING: Assume that this PitEntry was created with new, so that no copy constructor is invoked between calls.
-     * This class is private to Node and only used by its methods, so this should be OK.
-     * TODO: Doesn't this functionality belong in the Interest class?
-     * @return A reference to the ndn_Interest struct.
-     * WARNING: The resulting pointers in are invalid uses getInterest() to manipulate the object which could reallocate memory.
-     */
-    const struct ndn_Interest& 
-    getInterestStruct()
-    {
-      return *interestStruct_;
-    }
-    
-    /**
      * Check if this interest is timed out.
      * @param nowMilliseconds The current time in milliseconds from ndn_getNowMilliseconds.
      * @return true if this interest timed out, otherwise false.
@@ -185,15 +168,13 @@
     callTimeout();
     
   private:
-    ptr_lib::shared_ptr<const Interest> interest_;
-    std::vector<struct ndn_NameComponent> nameComponents_;
-    std::vector<struct ndn_ExcludeEntry> excludeEntries_;
-    ptr_lib::shared_ptr<struct ndn_Interest> interestStruct_;
-  
     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_;
+    
     MillisecondsSince1970 timeoutTimeMilliseconds_; /**< The time when the interest times out in milliseconds according to ndn_getNowMilliseconds, or -1 for no timeout. */
   };
 
@@ -206,7 +187,9 @@
      * @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), onInterest_(onInterest)
+      : registeredPrefixId_(registeredPrefixId)
+      , prefix_(prefix)
+      , onInterest_(onInterest)
     {
     }
     
@@ -223,79 +206,33 @@
      * Return the registeredPrefixId given to the constructor.
      */
     uint64_t 
-    getRegisteredPrefixId() { return registeredPrefixId_; }
+    getRegisteredPrefixId()
+    {
+      return registeredPrefixId_;
+    }
     
     const ptr_lib::shared_ptr<const Name>& 
-    getPrefix() { return prefix_; }
+    getPrefix()
+    {
+      return prefix_;
+    }
     
     const OnInterest& 
-    getOnInterest() { return onInterest_; }
+    getOnInterest()
+    {
+      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_;
     const OnInterest onInterest_;
   };
   
-  /**
-   * An NdndIdFetcher receives the Data packet with the publisher public key digest for the connected NDN hub.
-   * This class is a function object for the callbacks. It only holds a pointer to an Info object, so it is OK to copy the pointer.
-   */
-  class NdndIdFetcher {
-  public:
-    class Info;
-    NdndIdFetcher(ptr_lib::shared_ptr<NdndIdFetcher::Info> info)
-    : info_(info)
-    {      
-    }
-    
-    /**
-     * We received the ndnd ID.
-     * @param interest
-     * @param data
-     */
-    void 
-    operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData);
-
-    /**
-     * We timed out fetching the ndnd ID.
-     * @param interest
-     */
-    void 
-    operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest);
-    
-    class Info {
-    public:
-      /**
-       * 
-       * @param node
-       * @param registeredPrefixId The PrefixEntry::getNextRegisteredPrefixId() which registerPrefix got so it could return it to the caller.
-       * @param prefix
-       * @param onInterest
-       * @param onRegisterFailed
-       * @param flags
-       * @param wireFormat
-       */
-      Info(Node *node, uint64_t registeredPrefixId, const Name& prefix, const OnInterest& onInterest, 
-           const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat)
-      : node_(*node), registeredPrefixId_(registeredPrefixId), prefix_(new Name(prefix)), onInterest_(onInterest), onRegisterFailed_(onRegisterFailed), 
-        flags_(flags), wireFormat_(wireFormat)
-      {      
-      }
-      
-      Node& node_;
-      uint64_t registeredPrefixId_;
-      ptr_lib::shared_ptr<const Name> prefix_;
-      const OnInterest onInterest_;
-      const OnRegisterFailed onRegisterFailed_;
-      ForwardingFlags flags_;
-      WireFormat& wireFormat_;
-    };
-    
-  private:
-    ptr_lib::shared_ptr<Info> info_;
-  };
+  typedef std::vector<ptr_lib::shared_ptr<PendingInterest> > PendingInterestTable;
+  typedef std::vector<ptr_lib::shared_ptr<RegisteredPrefix> > RegisteredPrefixTable;
   
   /**
    * Find the entry from the pit_ where the name conforms to the entry's interest selectors, and
@@ -303,7 +240,7 @@
    * @param name The name to find the interest for (from the incoming data packet).
    * @return The index in pit_ of the pit entry, or -1 if not found.
    */
-  int 
+  PendingInterestTable::iterator 
   getEntryIndexForExpressedInterest(const Name& name);
   
   /**
@@ -311,7 +248,7 @@
    * @param name The name to find the PrefixEntry for (from the incoming interest packet).
    * @return A pointer to the entry, or 0 if not found.
    */
-  RegisteredPrefix*
+  RegisteredPrefixTable::iterator
   getEntryForRegisteredPrefix(const Name& name);
 
   /**
@@ -326,15 +263,23 @@
   void 
   registerPrefixHelper
     (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest, 
-     const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat);
+     const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags);
+
+  void
+  checkPitExpire();
+  
+private:
+  boost::asio::io_service ioService_;
+  boost::asio::deadline_timer timer_;
   
   ptr_lib::shared_ptr<Transport> transport_;
-  std::vector<ptr_lib::shared_ptr<PendingInterest> > pendingInterestTable_;
-  std::vector<ptr_lib::shared_ptr<RegisteredPrefix> > registeredPrefixTable_;
+
+  PendingInterestTable pendingInterestTable_;
+  RegisteredPrefixTable registeredPrefixTable_;
   Interest ndndIdFetcherInterest_;
-  Blob ndndId_;
+  Buffer ndndId_;
 };
 
-}
+} // namespace ndn
 
 #endif
diff --git a/include/ndn-cpp/transport/transport.hpp b/include/ndn-cpp/transport/transport.hpp
index 80d41b2..8bfa355 100644
--- a/include/ndn-cpp/transport/transport.hpp
+++ b/include/ndn-cpp/transport/transport.hpp
@@ -8,58 +8,88 @@
 #ifndef NDN_TRANSPORT_HPP
 #define NDN_TRANSPORT_HPP
 
+#include <ndn-cpp/common.hpp>
+
 #include <vector>
+#include <boost/asio.hpp>
 
 namespace ndn {
 
-class ElementListener;
-
 class Transport {
 public:
+  typedef ptr_lib::function<void (const Block &wire)> ReceiveCallback;
+  
+  inline
+  Transport();
+  
+  inline virtual
+  ~Transport();
+
   /**
    * Connect according to the info in ConnectionInfo, and processEvents() will use elementListener.
    * @param connectionInfo A reference to an object of a subclass of ConnectionInfo.
-   * @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
+   */
+  inline virtual void 
+  connect(boost::asio::io_service &io_service, const ReceiveCallback &receiveCallback);
+  
+  /**
+   * Close the connection.
    */
   virtual void 
-  connect(ElementListener& elementListener) = 0;
-  
+  close() = 0;
+
   /**
    * Set data to the host
    * @param data A pointer to the buffer of data to send.
    * @param dataLength The number of bytes in data.
    */
   virtual void 
-  send(const uint8_t *data, size_t dataLength) = 0;
-  
-  inline void 
-  send(const std::vector<uint8_t>& data)
-  {
-    send(&data[0], data.size());
-  }
-  
-  /**
-   * Process any data to receive.  For each element received, call elementListener.onReceivedElement.
-   * This is non-blocking and will return immediately if there is no data to receive.
-   * You should normally not call this directly since it is called by Face.processEvents.
-   * @throw This may throw an exception for reading data or in the callback for processing the data.  If you
-   * call this from an main event loop, you may want to catch and log/disregard all exceptions.
-   */
-  virtual void 
-  processEvents() = 0;
+  send(const Block &wire) = 0;
 
-  virtual bool 
-  getIsConnected() = 0;
+  inline bool 
+  isConnected();
+
+protected:
+  inline void
+  receive(const Block &wire);
   
-  /**
-   * Close the connection.  This base class implementation does nothing, but your derived class can override.
-   */
-  virtual void 
-  close();
-  
-  virtual ~Transport();
+protected:
+  boost::asio::io_service *ioService_;
+  bool isConnected_;
+  ReceiveCallback receiveCallback_;
 };
 
+inline
+Transport::Transport()
+  : ioService_(0)
+  , isConnected_(false)
+{
+}
+
+inline
+Transport::~Transport()
+{
+}
+
+inline void 
+Transport::connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
+{
+  ioService_ = &ioService;
+  receiveCallback_ = receiveCallback;
+}
+
+inline bool 
+Transport::isConnected()
+{
+  return isConnected_;
+}
+
+inline void
+Transport::receive(const Block &wire)
+{
+  receiveCallback_(wire);
+}
+
 }
 
 #endif
diff --git a/include/ndn-cpp/transport/unix-transport.hpp b/include/ndn-cpp/transport/unix-transport.hpp
index bb77bb4..1cc4758 100644
--- a/include/ndn-cpp/transport/unix-transport.hpp
+++ b/include/ndn-cpp/transport/unix-transport.hpp
@@ -13,49 +13,24 @@
 
 namespace ndn {
   
-class UnixTransport : public Transport {
+class UnixTransport : public Transport
+{
 public:
   UnixTransport(const std::string &unixSocket = "/tmp/.ndnd.sock");
   ~UnixTransport();
 
-  /**
-   * Connect according to the info in ConnectionInfo, and processEvents() will use elementListener.
-   * @param connectionInfo A reference to a TcpTransport::ConnectionInfo.
-   * @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
-   */
+  // from Transport
   virtual void 
-  connect(ElementListener& elementListener);
+  connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback);
   
-  /**
-   * Set data to the host
-   * @param data A pointer to the buffer of data to send.
-   * @param dataLength The number of bytes in data.
-   */
-  virtual void 
-  send(const uint8_t *data, size_t dataLength);
-
-  /**
-   * Process any data to receive.  For each element received, call elementListener.onReceivedElement.
-   * This is non-blocking and will return immediately if there is no data to receive.
-   * You should normally not call this directly since it is called by Face.processEvents.
-   * @throw This may throw an exception for reading data or in the callback for processing the data.  If you
-   * call this from an main event loop, you may want to catch and log/disregard all exceptions.
-   */
-  virtual void 
-  processEvents();
-  
-  virtual bool 
-  getIsConnected();
-
-  /**
-   * Close the connection to the host.
-   */
   virtual void 
   close();
+
+  virtual void 
+  send(const Block &wire);
   
 private:
   std::string unixSocket_;
-  bool isConnected_;
 
   class Impl;
   std::auto_ptr<Impl> impl_;
diff --git a/src/face.cpp b/src/face.cpp
index f5ce755..9faabe9 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -13,17 +13,20 @@
   
 uint64_t 
 Face::expressInterest
-  (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout,
-   WireFormat& wireFormat)
+  (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
 {
   if (interestTemplate)
     return node_.expressInterest(Interest
-      (name, interestTemplate->getMinSuffixComponents(), interestTemplate->getMaxSuffixComponents(),
-       interestTemplate->getPublisherPublicKeyDigest(), interestTemplate->getExclude(),
-       interestTemplate->getChildSelector(), interestTemplate->getAnswerOriginKind(),
-       interestTemplate->getScope(), interestTemplate->getInterestLifetimeMilliseconds()), onData, onTimeout, wireFormat);
+      (name,
+       interestTemplate->getMinSuffixComponents(), interestTemplate->getMaxSuffixComponents(),
+       interestTemplate->getExclude(),
+       interestTemplate->getChildSelector(),
+       interestTemplate->getMustBeFresh(),
+       interestTemplate->getScope(),
+       interestTemplate->getInterestLifetime()),
+      onData, onTimeout);
   else
-    return node_.expressInterest(Interest(name, 4000.0), onData, onTimeout, wireFormat);  
+    return node_.expressInterest(Interest(name, 4000.0), onData, onTimeout);  
 }
 
 void 
diff --git a/src/node.cpp b/src/node.cpp
index ee14ece..5671269 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -6,130 +6,43 @@
  */
 
 #include <stdexcept>
-#include "c/name.h"
-#include "c/interest.h"
-#include "c/util/crypto.h"
 #include "c/util/time.h"
 
 #include <ndn-cpp/forwarding-entry.hpp>
-#include <ndn-cpp/security/key-chain.hpp>
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
 #include <ndn-cpp/node.hpp>
 
-#include <ndn-cpp/encoding/tlv-element.hpp>
+#include "util/ndnd-id-fetcher.hpp"
+
+#include <ndn-cpp/encoding/block.hpp>
 
 using namespace std;
 
 namespace ndn {
 
-static uint8_t SELFREG_PUBLIC_KEY_DER[] = {
-0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
-0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
-0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
-0x9F, 0x3F, 0x08, 0xBC, 0xD0, 0x99, 0xDB, 0x21, 0xDD, 0x16, 0x2A, 0x77, 0x9E, 0x61, 0xAA, 0x89, 0xEE, 0xE5, 0x54, 0xD3,
-0xA4, 0x7D, 0xE2, 0x30, 0xBC, 0x7A, 0xC5, 0x90, 0xD5, 0x24, 0x06, 0x7C, 0x38, 0x98, 0xBB, 0xA6, 0xF5, 0xDC, 0x43, 0x60,
-0xB8, 0x45, 0xED, 0xA4, 0x8C, 0xBD, 0x9C, 0xF1, 0x26, 0xA7, 0x23, 0x44, 0x5F, 0x0E, 0x19, 0x52, 0xD7, 0x32, 0x5A, 0x75,
-0xFA, 0xF5, 0x56, 0x14, 0x4F, 0x9A, 0x98, 0xAF, 0x71, 0x86, 0xB0, 0x27, 0x86, 0x85, 0xB8, 0xE2, 0xC0, 0x8B, 0xEA, 0x87,
-0x17, 0x1B, 0x4D, 0xEE, 0x58, 0x5C, 0x18, 0x28, 0x29, 0x5B, 0x53, 0x95, 0xEB, 0x4A, 0x17, 0x77, 0x9F, 0x02, 0x03, 0x01,
-0x00, 01
-};
-
-static uint8_t SELFREG_PRIVATE_KEY_DER[] = {
-0x30, 0x82, 0x02, 0x5d, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xe1, 0x7d, 0x30, 0xa7, 0xd8, 0x28, 0xab, 0x1b, 0x84,
-0x0b, 0x17, 0x54, 0x2d, 0xca, 0xf6, 0x20, 0x7a, 0xfd, 0x22, 0x1e, 0x08, 0x6b, 0x2a, 0x60, 0xd1, 0x6c, 0xb7, 0xf5, 0x44,
-0x48, 0xba, 0x9f, 0x3f, 0x08, 0xbc, 0xd0, 0x99, 0xdb, 0x21, 0xdd, 0x16, 0x2a, 0x77, 0x9e, 0x61, 0xaa, 0x89, 0xee, 0xe5,
-0x54, 0xd3, 0xa4, 0x7d, 0xe2, 0x30, 0xbc, 0x7a, 0xc5, 0x90, 0xd5, 0x24, 0x06, 0x7c, 0x38, 0x98, 0xbb, 0xa6, 0xf5, 0xdc,
-0x43, 0x60, 0xb8, 0x45, 0xed, 0xa4, 0x8c, 0xbd, 0x9c, 0xf1, 0x26, 0xa7, 0x23, 0x44, 0x5f, 0x0e, 0x19, 0x52, 0xd7, 0x32,
-0x5a, 0x75, 0xfa, 0xf5, 0x56, 0x14, 0x4f, 0x9a, 0x98, 0xaf, 0x71, 0x86, 0xb0, 0x27, 0x86, 0x85, 0xb8, 0xe2, 0xc0, 0x8b,
-0xea, 0x87, 0x17, 0x1b, 0x4d, 0xee, 0x58, 0x5c, 0x18, 0x28, 0x29, 0x5b, 0x53, 0x95, 0xeb, 0x4a, 0x17, 0x77, 0x9f, 0x02,
-0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x1a, 0x4b, 0xfa, 0x4f, 0xa8, 0xc2, 0xdd, 0x69, 0xa1, 0x15, 0x96, 0x0b, 0xe8,
-0x27, 0x42, 0x5a, 0xf9, 0x5c, 0xea, 0x0c, 0xac, 0x98, 0xaa, 0xe1, 0x8d, 0xaa, 0xeb, 0x2d, 0x3c, 0x60, 0x6a, 0xfb, 0x45,
-0x63, 0xa4, 0x79, 0x83, 0x67, 0xed, 0xe4, 0x15, 0xc0, 0xb0, 0x20, 0x95, 0x6d, 0x49, 0x16, 0xc6, 0x42, 0x05, 0x48, 0xaa,
-0xb1, 0xa5, 0x53, 0x65, 0xd2, 0x02, 0x99, 0x08, 0xd1, 0x84, 0xcc, 0xf0, 0xcd, 0xea, 0x61, 0xc9, 0x39, 0x02, 0x3f, 0x87,
-0x4a, 0xe5, 0xc4, 0xd2, 0x07, 0x02, 0xe1, 0x9f, 0xa0, 0x06, 0xc2, 0xcc, 0x02, 0xe7, 0xaa, 0x6c, 0x99, 0x8a, 0xf8, 0x49,
-0x00, 0xf1, 0xa2, 0x8c, 0x0c, 0x8a, 0xb9, 0x4f, 0x6d, 0x73, 0x3b, 0x2c, 0xb7, 0x9f, 0x8a, 0xa6, 0x7f, 0x9b, 0x9f, 0xb7,
-0xa1, 0xcc, 0x74, 0x2e, 0x8f, 0xb8, 0xb0, 0x26, 0x89, 0xd2, 0xe5, 0x66, 0xe8, 0x8e, 0xa1, 0x02, 0x41, 0x00, 0xfc, 0xe7,
-0x52, 0xbc, 0x4e, 0x95, 0xb6, 0x1a, 0xb4, 0x62, 0xcc, 0xd8, 0x06, 0xe1, 0xdc, 0x7a, 0xa2, 0xb6, 0x71, 0x01, 0xaa, 0x27,
-0xfc, 0x99, 0xe5, 0xf2, 0x54, 0xbb, 0xb2, 0x85, 0xe1, 0x96, 0x54, 0x2d, 0xcb, 0xba, 0x86, 0xfa, 0x80, 0xdf, 0xcf, 0x39,
-0xe6, 0x74, 0xcb, 0x22, 0xce, 0x70, 0xaa, 0x10, 0x00, 0x73, 0x1d, 0x45, 0x0a, 0x39, 0x51, 0x84, 0xf5, 0x15, 0x8f, 0x37,
-0x76, 0x91, 0x02, 0x41, 0x00, 0xe4, 0x3f, 0xf0, 0xf4, 0xde, 0x79, 0x77, 0x48, 0x9b, 0x9c, 0x28, 0x45, 0x26, 0x57, 0x3c,
-0x71, 0x40, 0x28, 0x6a, 0xa1, 0xfe, 0xc3, 0xe5, 0x37, 0xa1, 0x03, 0xf6, 0x2d, 0xbe, 0x80, 0x64, 0x72, 0x69, 0x2e, 0x9b,
-0x4d, 0xe3, 0x2e, 0x1b, 0xfe, 0xe7, 0xf9, 0x77, 0x8c, 0x18, 0x53, 0x9f, 0xe2, 0xfe, 0x00, 0xbb, 0x49, 0x20, 0x47, 0xdf,
-0x01, 0x61, 0x87, 0xd6, 0xe3, 0x44, 0xb5, 0x03, 0x2f, 0x02, 0x40, 0x54, 0xec, 0x7c, 0xbc, 0xdd, 0x0a, 0xaa, 0xde, 0xe6,
-0xc9, 0xf2, 0x8d, 0x6c, 0x2a, 0x35, 0xf6, 0x3c, 0x63, 0x55, 0x29, 0x40, 0xf1, 0x32, 0x82, 0x9f, 0x53, 0xb3, 0x9e, 0x5f,
-0xc1, 0x53, 0x52, 0x3e, 0xac, 0x2e, 0x28, 0x51, 0xa1, 0x16, 0xdb, 0x90, 0xe3, 0x99, 0x7e, 0x88, 0xa4, 0x04, 0x7c, 0x92,
-0xae, 0xd2, 0xe7, 0xd4, 0xe1, 0x55, 0x20, 0x90, 0x3e, 0x3c, 0x6a, 0x63, 0xf0, 0x34, 0xf1, 0x02, 0x41, 0x00, 0x84, 0x5a,
-0x17, 0x6c, 0xc6, 0x3c, 0x84, 0xd0, 0x93, 0x7a, 0xff, 0x56, 0xe9, 0x9e, 0x98, 0x2b, 0xcb, 0x5a, 0x24, 0x4a, 0xff, 0x21,
-0xb4, 0x9e, 0x87, 0x3d, 0x76, 0xd8, 0x9b, 0xa8, 0x73, 0x96, 0x6c, 0x2b, 0x5c, 0x5e, 0xd3, 0xa6, 0xff, 0x10, 0xd6, 0x8e,
-0xaf, 0xa5, 0x8a, 0xcd, 0xa2, 0xde, 0xcb, 0x0e, 0xbd, 0x8a, 0xef, 0xae, 0xfd, 0x3f, 0x1d, 0xc0, 0xd8, 0xf8, 0x3b, 0xf5,
-0x02, 0x7d, 0x02, 0x41, 0x00, 0x8b, 0x26, 0xd3, 0x2c, 0x7d, 0x28, 0x38, 0x92, 0xf1, 0xbf, 0x15, 0x16, 0x39, 0x50, 0xc8,
-0x6d, 0x32, 0xec, 0x28, 0xf2, 0x8b, 0xd8, 0x70, 0xc5, 0xed, 0xe1, 0x7b, 0xff, 0x2d, 0x66, 0x8c, 0x86, 0x77, 0x43, 0xeb,
-0xb6, 0xf6, 0x50, 0x66, 0xb0, 0x40, 0x24, 0x6a, 0xaf, 0x98, 0x21, 0x45, 0x30, 0x01, 0x59, 0xd0, 0xc3, 0xfc, 0x7b, 0xae,
-0x30, 0x18, 0xeb, 0x90, 0xfb, 0x17, 0xd3, 0xce, 0xb5
-};
-
 uint64_t Node::PendingInterest::lastPendingInterestId_ = 0;
 uint64_t Node::RegisteredPrefix::lastRegisteredPrefixId_ = 0;
 
-/**
- * Set the KeyLocator using the full SELFREG_PUBLIC_KEY_DER, sign the data packet using SELFREG_PRIVATE_KEY_DER 
- * and set the signature.
- * This is a temporary function, because we expect in the future that registerPrefix will not require a signature on the packet.
- * @param data The Data packet to sign.
- * @param wireFormat The WireFormat for encoding the Data packet.
- */
-static void
-selfregSign(Data& data, WireFormat& wireFormat)
-{
-  data.setSignature(Sha256WithRsaSignature());
-  Sha256WithRsaSignature *signature = dynamic_cast<Sha256WithRsaSignature*>(data.getSignature());
-  
-  // Set the public key.
-  uint8_t publicKeyDigest[SHA256_DIGEST_LENGTH];
-  ndn_digestSha256(SELFREG_PUBLIC_KEY_DER, sizeof(SELFREG_PUBLIC_KEY_DER), publicKeyDigest);
-  signature->getPublisherPublicKeyDigest().setPublisherPublicKeyDigest(Blob(publicKeyDigest, sizeof(publicKeyDigest)));
-  signature->getKeyLocator().setType(ndn_KeyLocatorType_KEY);
-  signature->getKeyLocator().setKeyData(Blob(SELFREG_PUBLIC_KEY_DER, sizeof(SELFREG_PUBLIC_KEY_DER)));
-
-  // Sign the fields.
-  SignedBlob encoding = data.wireEncode(wireFormat);
-  uint8_t signedPortionDigest[SHA256_DIGEST_LENGTH];
-  ndn_digestSha256(encoding.signedBuf(), encoding.signedSize(), signedPortionDigest);
-  uint8_t signatureBits[1000];
-  unsigned int signatureBitsLength;
-  // Use a temporary pointer since d2i updates it.
-  const uint8_t *derPointer = SELFREG_PRIVATE_KEY_DER;
-  RSA *privateKey = d2i_RSAPrivateKey(NULL, &derPointer, sizeof(SELFREG_PRIVATE_KEY_DER));
-  if (!privateKey)
-    throw runtime_error("Error decoding private key in d2i_RSAPrivateKey");
-  int success = RSA_sign(NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), signatureBits, &signatureBitsLength, privateKey);
-  // Free the private key before checking for success.
-  RSA_free(privateKey);
-  if (!success)
-    throw runtime_error("Error in RSA_sign");
-  
-  signature->setSignature(Blob(signatureBits, (size_t)signatureBitsLength));
-}
-
 Node::Node(const ptr_lib::shared_ptr<Transport>& transport)
-: transport_(transport),
-  ndndIdFetcherInterest_(Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY"), 4000.0)
+  : timer_ (ioService_)
+  , transport_(transport)
+  , ndndIdFetcherInterest_(Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY"), 4000.0)
 {
+  timer_.expires_from_now(boost::posix_time::milliseconds(100));
+  timer_.async_wait(func_lib::bind(&Node::checkPitExpire, this));
 }
 
 uint64_t 
-Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout, WireFormat& wireFormat)
+Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
 {
   // TODO: Properly check if we are already connected to the expected host.
-  if (!transport_->getIsConnected())
-    transport_->connect(*this);
+  if (!transport_->isConnected())
+    transport_->connect(ioService_, ptr_lib::bind(&Node::onReceiveElement, this, _1));
   
   uint64_t pendingInterestId = PendingInterest::getNextPendingInterestId();
   pendingInterestTable_.push_back(ptr_lib::shared_ptr<PendingInterest>(new PendingInterest
     (pendingInterestId, ptr_lib::shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout)));
-  
-  Blob encoding = interest.wireEncode(wireFormat);  
-  transport_->send(*encoding);
+
+  transport_->send(interest.wireEncode());
   
   return pendingInterestId;
 }
@@ -147,21 +60,25 @@
 
 uint64_t 
 Node::registerPrefix
-  (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat)
+  (const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags)
 {
   // Get the registeredPrefixId now so we can return it to the caller.
   uint64_t registeredPrefixId = RegisteredPrefix::getNextRegisteredPrefixId();
-
+  ptr_lib::shared_ptr<const Name> prefixPtr = ptr_lib::make_shared<const Name>(prefix);
+  
   if (ndndId_.size() == 0) {
     // First fetch the ndndId of the connected hub.
-    NdndIdFetcher fetcher
-      (ptr_lib::shared_ptr<NdndIdFetcher::Info>(new NdndIdFetcher::Info
-        (this, registeredPrefixId, prefix, onInterest, onRegisterFailed, flags, wireFormat)));
+    NdndIdFetcher fetcher(ndndId_,
+                          func_lib::bind(&Node::registerPrefixHelper, this,
+                                         registeredPrefixId, prefixPtr, onInterest, onRegisterFailed, flags),
+                          func_lib::bind(onRegisterFailed, prefixPtr));
+
+    // @todo: Check if this crash
     // It is OK for func_lib::function make a copy of the function object because the Info is in a ptr_lib::shared_ptr.
-    expressInterest(ndndIdFetcherInterest_, fetcher, fetcher, wireFormat);
+    expressInterest(ndndIdFetcherInterest_, fetcher, fetcher);
   }
   else
-    registerPrefixHelper(registeredPrefixId, ptr_lib::make_shared<const Name>(prefix), onInterest, onRegisterFailed, flags, wireFormat);
+    registerPrefixHelper(registeredPrefixId, prefixPtr, onInterest, onRegisterFailed, flags);
   
   return registeredPrefixId;
 }
@@ -178,45 +95,23 @@
 }
 
 void 
-Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
-{
-  const Sha256WithRsaSignature *signature = dynamic_cast<const Sha256WithRsaSignature*>(ndndIdData->getSignature());
-  if (signature && signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
-    // Set the ndndId_ and continue.
-    // TODO: If there are multiple connected hubs, the NDN ID is really stored per connected hub.
-    info_->node_.ndndId_ = signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
-    info_->node_.registerPrefixHelper
-      (info_->registeredPrefixId_, info_->prefix_, info_->onInterest_, info_->onRegisterFailed_, info_->flags_, info_->wireFormat_);
-  }
-  else
-    info_->onRegisterFailed_(info_->prefix_);
-}
-
-void 
-Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
-{
-  info_->onRegisterFailed_(info_->prefix_);
-}
-
-void 
 Node::registerPrefixHelper
   (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, 
-   const ForwardingFlags& flags, WireFormat& wireFormat)
+   const ForwardingFlags& flags)
 {
   // Create a ForwardingEntry.
 
   // AlexA: ndnd ignores any freshness that is larger than 3600 sec and sets 300 sec instead
   //        to register "forever" (=2000000000 sec), freshnessPeriod must be omitted
-  ForwardingEntry forwardingEntry("selfreg", *prefix, PublisherPublicKeyDigest(), -1, flags, -1);
-  Blob content = forwardingEntry.wireEncode();
+  ForwardingEntry forwardingEntry("selfreg", *prefix, -1, flags, -1);
+  Block content = forwardingEntry.wireEncode();
 
   // Set the ForwardingEntry as the content of a Data packet and sign.
   Data data;
   data.setContent(content);
-  data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
   // For now, self sign with an arbirary key.  In the future, we may not require a signature to register.
-  selfregSign(data, wireFormat);
-  Blob encodedData = data.wireEncode();
+  // selfregSign(data);
+  const Block &encodedData = data.wireEncode();
   
   // Create an interest where the name has the encoded Data packet.
   Name interestName;
@@ -229,19 +124,25 @@
   
   Interest interest(interestName);
   interest.setScope(1);
-  Blob encodedInterest = interest.wireEncode();
   
   // Save the onInterest callback and send the registration interest.
-  registeredPrefixTable_.push_back(ptr_lib::shared_ptr<RegisteredPrefix>(new RegisteredPrefix(registeredPrefixId, prefix, onInterest)));
+  registeredPrefixTable_.push_back(ptr_lib::make_shared<RegisteredPrefix>(registeredPrefixId, prefix, onInterest));
   
-  transport_->send(*encodedInterest);
+  transport_->send(interest.wireEncode());
 }
 
 void 
 Node::processEvents()
 {
-  transport_->processEvents();
-  
+  ioService_.run();
+
+  // auto_ptr<boost::asio::io_service::work> work(new boost::asio::io_service::work(ioService_));
+  // work.reset(); // Allow run() to exit.   
+}
+
+void
+Node::checkPitExpire()
+{
   // Check for PIT entry timeouts.  Go backwards through the list so we can erase entries.
   MillisecondsSince1970 nowMilliseconds = ndn_getNowMilliseconds();
   for (int i = (int)pendingInterestTable_.size() - 1; i >= 0; --i) {
@@ -255,32 +156,36 @@
       nowMilliseconds = ndn_getNowMilliseconds();
     }
   }
+
+  timer_.expires_from_now(boost::posix_time::milliseconds(100));
+  timer_.async_wait(func_lib::bind(&Node::checkPitExpire, this));
 }
 
+
 void 
-Node::onReceivedElement(const uint8_t *element, size_t elementLength)
+Node::onReceiveElement(const Block &block)
 {
-  tlv::Element parsedElement(element, elementLength);
-  if (parsedElement.type() == tlv::Interest)
+  if (block.type() == Tlv::Interest)
     {
       ptr_lib::shared_ptr<Interest> interest(new Interest());
-      interest->wireDecode(element, elementLength);
+      interest->wireDecode(block);
     
-      RegisteredPrefix *entry = getEntryForRegisteredPrefix(interest->getName());
-      if (entry)
-        entry->getOnInterest()(entry->getPrefix(), interest, *transport_, entry->getRegisteredPrefixId());
+      RegisteredPrefixTable::iterator entry = getEntryForRegisteredPrefix(interest->getName());
+      if (entry != registeredPrefixTable_.end()) {
+        (*entry)->getOnInterest()((*entry)->getPrefix(), interest, *transport_, (*entry)->getRegisteredPrefixId());
+      }
     }
-  else if (parsedElement.type() == tlv::Data)
+  else if (block.type() == Tlv::Data)
     {
       ptr_lib::shared_ptr<Data> data(new Data());
-      data->wireDecode(element, elementLength);
-    
-      int iPitEntry = getEntryIndexForExpressedInterest(data->getName());
-      if (iPitEntry >= 0) {
+      data->wireDecode(block);
+
+      PendingInterestTable::iterator entry = getEntryIndexForExpressedInterest(data->getName());
+      if (entry != pendingInterestTable_.end()) {
         // Copy pointers to the needed objects and remove the PIT entry before the calling the callback.
-        const OnData onData = pendingInterestTable_[iPitEntry]->getOnData();
-        const ptr_lib::shared_ptr<const Interest> interest = pendingInterestTable_[iPitEntry]->getInterest();
-        pendingInterestTable_.erase(pendingInterestTable_.begin() + iPitEntry);
+        const OnData onData = (*entry)->getOnData();
+        const ptr_lib::shared_ptr<const Interest> interest = (*entry)->getInterest();
+        pendingInterestTable_.erase(entry);
         onData(interest, data);
       }
     }
@@ -290,72 +195,55 @@
 Node::shutdown()
 {
   transport_->close();
+  ioService_.stop();
 }
 
-int 
+Node::PendingInterestTable::iterator 
 Node::getEntryIndexForExpressedInterest(const Name& name)
 {
-  // TODO: Doesn't this belong in the Name class?
-  vector<struct ndn_NameComponent> nameComponents;
-  nameComponents.reserve(name.size());
-  struct ndn_Name nameStruct;
-  ndn_Name_initialize(&nameStruct, &nameComponents[0], nameComponents.capacity());
-  name.get(nameStruct);
-  
-  int iResult = -1;
-    
-  for (size_t i = 0; i < pendingInterestTable_.size(); ++i) {
-    if (ndn_Interest_matchesName((struct ndn_Interest *)&pendingInterestTable_[i]->getInterestStruct(), &nameStruct)) {
-      if (iResult < 0 || 
-          pendingInterestTable_[i]->getInterestStruct().name.nComponents > 
-          pendingInterestTable_[iResult]->getInterestStruct().name.nComponents)
-        // Update to the longer match.
-        iResult = i;
+  for (PendingInterestTable::iterator i = pendingInterestTable_.begin ();
+       i != pendingInterestTable_.end(); ++i)
+    {
+      if ((*i)->getInterest()->matchesName(name))
+        {
+          return i;
+        }
     }
-  }
-    
-  return iResult;
+
+  return pendingInterestTable_.end();
 }
   
-Node::RegisteredPrefix*
+Node::RegisteredPrefixTable::iterator
 Node::getEntryForRegisteredPrefix(const Name& name)
 {
-  int iResult = -1;
-    
-  for (size_t i = 0; i < registeredPrefixTable_.size(); ++i) {
-    if (registeredPrefixTable_[i]->getPrefix()->match(name)) {
-      if (iResult < 0 || 
-          registeredPrefixTable_[i]->getPrefix()->size() > registeredPrefixTable_[iResult]->getPrefix()->size())
-        // Update to the longer match.
-        iResult = i;
+  RegisteredPrefixTable::iterator longestPrefix = registeredPrefixTable_.end();
+
+  for (RegisteredPrefixTable::iterator i = registeredPrefixTable_.begin();
+       i != registeredPrefixTable_.end();
+       ++i)
+    {
+      if (longestPrefix == registeredPrefixTable_.end() ||
+          (*i)->getPrefix()->size() > (*longestPrefix)->getPrefix()->size())
+        {
+          longestPrefix = i;
+        }
     }
-  }
-    
-  if (iResult >= 0)
-    return registeredPrefixTable_[iResult].get();
-  else
-    return 0;
+  return longestPrefix;
 }
 
-Node::PendingInterest::PendingInterest
-  (uint64_t pendingInterestId, const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
-: pendingInterestId_(pendingInterestId), interest_(interest), onData_(onData), onTimeout_(onTimeout),
-  interestStruct_(new struct ndn_Interest)
+Node::PendingInterest::PendingInterest(uint64_t pendingInterestId,
+                                       const ptr_lib::shared_ptr<const Interest>& interest,
+                                       const OnData& onData, const OnTimeout& onTimeout)
+: pendingInterestId_(pendingInterestId),
+  interest_(interest),
+  onData_(onData), onTimeout_(onTimeout)
 {
   // Set up timeoutTime_.
-  if (interest_->getInterestLifetimeMilliseconds() >= 0)
-    timeoutTimeMilliseconds_ = ndn_getNowMilliseconds() + interest_->getInterestLifetimeMilliseconds();
+  if (interest_->getInterestLifetime() >= 0)
+    timeoutTimeMilliseconds_ = ndn_getNowMilliseconds() + interest_->getInterestLifetime();
   else
     // No timeout.
     timeoutTimeMilliseconds_ = -1;
-  
-  // Set up interestStruct_.
-  // TODO: Doesn't this belong in the Interest class?
-  nameComponents_.reserve(interest_->getName().size());
-  excludeEntries_.reserve(interest_->getExclude().size());
-  ndn_Interest_initialize
-    (interestStruct_.get(), &nameComponents_[0], nameComponents_.capacity(), &excludeEntries_[0], excludeEntries_.capacity());
-  interest_->get(*interestStruct_);  
 }
 
 void 
diff --git a/src/transport/transport.cpp b/src/transport/transport.cpp
deleted file mode 100644
index 4d5db21..0000000
--- a/src/transport/transport.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#include <stdexcept>
-#include <ndn-cpp/transport/transport.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-void 
-Transport::close()
-{
-}
-
-Transport::~Transport()
-{
-}
-
-}
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index 603f5e3..811e0d4 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -15,7 +15,7 @@
 #include <boost/bind.hpp>
 
 using namespace std;
-typedef boost::asio::local::datagram_protocol protocol;
+typedef boost::asio::local::stream_protocol protocol;
 
 namespace ndn {
 
@@ -24,67 +24,77 @@
 class UnixTransport::Impl
 {
 public:
-  Impl() : socket_(io_)
+  Impl(UnixTransport &transport)
+    : transport_(transport),
+      socket_(*transport_.ioService_)
   {
   }
 
-  bool
-  connect(const std::string &unixSocket, ElementListener& elementListener)
+  void
+  connect()
   {
     socket_.open();
-    socket_.connect(protocol::endpoint(unixSocket));
+    socket_.connect(protocol::endpoint(transport_.unixSocket_));
     // socket_.async_connect(protocol::endpoint(unixSocket));
 
     socket_.async_receive(boost::asio::buffer(inputBuffer_, MAX_LENGTH), 0,
                           boost::bind(&Impl::handle_async_receive, this, _1, _2));
-
-    return true;
   }
 
   void 
-  send(const uint8_t *data, size_t dataLength)
-  {
-    socket_.send(boost::asio::buffer(data, dataLength));
-  }
-
-  void
-  processEvents()
-  {
-    io_.poll();
-    // from boost docs:
-    // The poll() function runs handlers that are ready to run, without blocking, until the io_service has been stopped or there are no more ready handlers.
-  }
-
-  void
-  handle_async_receive(const boost::system::error_code& error, std::size_t bytes_recvd)
-  {
-    if (!error && bytes_recvd > 0)
-      {
-        // inputBuffer_ has bytes_recvd received bytes of data
-      }
-
-    socket_.async_receive(boost::asio::buffer(inputBuffer_, MAX_LENGTH), 0,
-                          boost::bind(&Impl::handle_async_receive, this, _1, _2));
-  }
-  
-  void 
   close()
   {
     socket_.close();
   }
+
+  void 
+  send(const Block &wire)
+  {
+    socket_.async_send(boost::asio::buffer(wire.wire(), wire.size()),
+                       boost::bind(&Impl::handle_async_send, this, _1, wire));
+  }
+  
+  void
+  handle_async_receive(const boost::system::error_code& error, std::size_t bytes_recvd)
+  {
+    /// @todo The socket is not datagram, so need to have internal buffer to handle partial data reception
+    
+    if (!error && bytes_recvd > 0)
+      {
+        // inputBuffer_ has bytes_recvd received bytes of data
+        try {
+          Block element(inputBuffer_, bytes_recvd);
+          transport_.receive(element);
+        }
+        catch(Tlv::Error &error)
+          {
+            // pass
+          }
+        catch(Block::Error &error)
+          {
+            // pass
+          }
+      }
+
+    socket_.async_receive(boost::asio::buffer(inputBuffer_, MAX_LENGTH), 0,
+                          boost::bind(&Impl::handle_async_receive, this, _1, _2));
+  }
+
+  void
+  handle_async_send(const boost::system::error_code& error, const Block &wire)
+  {
+    // pass
+  }
   
 private:
-  boost::asio::io_service io_;
-
+  UnixTransport &transport_;
+  
   protocol::socket socket_;
-
   uint8_t inputBuffer_[MAX_LENGTH];
 };
 
 UnixTransport::UnixTransport(const std::string &unixSocket/* = "/tmp/.ndnd.sock"*/) 
   : unixSocket_(unixSocket)
-  , isConnected_(false)
-  , impl_(new UnixTransport::Impl())
 {
 }
 
@@ -93,30 +103,20 @@
 }
 
 void 
-UnixTransport::connect(ElementListener& elementListener)
+UnixTransport::connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
 {
-  if (impl_->connect(unixSocket_, elementListener))
-    {
-      isConnected_ = true;
-    }
+  Transport::connect(ioService, receiveCallback);
+  
+  impl_ = std::auto_ptr<UnixTransport::Impl> (new UnixTransport::Impl(*this));
+  impl_->connect();
+  
+  isConnected_ = true;
 }
 
 void 
-UnixTransport::send(const uint8_t *data, size_t dataLength)
+UnixTransport::send(const Block &wire)
 {
-  impl_->send(data, dataLength);
-}
-
-void 
-UnixTransport::processEvents()
-{
-  impl_->processEvents();
-}
-
-bool 
-UnixTransport::getIsConnected()
-{
-  return isConnected_;
+  impl_->send(wire);
 }
 
 void 
diff --git a/src/util/ndnd-id-fetcher.hpp b/src/util/ndnd-id-fetcher.hpp
new file mode 100644
index 0000000..1a938f9
--- /dev/null
+++ b/src/util/ndnd-id-fetcher.hpp
@@ -0,0 +1,77 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_NDND_ID_FETCHER_HPP
+#define NDN_NDND_ID_FETCHER_HPP
+
+#include <ndn-cpp/common.hpp>
+#include "../c/util/crypto.h"
+
+namespace ndn {
+
+/**
+ * An NdndIdFetcher receives the Data packet with the publisher public key digest for the connected NDN hub.
+ * This class is a function object for the callbacks. It only holds a pointer to an Info object, so it is OK to copy the pointer.
+ */
+class NdndIdFetcher {
+public:
+  typedef func_lib::function<void (void)> OnSuccess;
+  typedef func_lib::function<void (void)> OnFailure;
+  
+  
+  class Info;
+  NdndIdFetcher(Buffer &ndndId, const OnSuccess& onSuccess, const OnFailure& onFailure)
+    : ndndId_(ndndId)
+    , onSuccess_(onSuccess)
+    , onFailure_(onFailure)
+  {
+  }
+    
+  /**
+   * We received the ndnd ID.
+   * @param interest
+   * @param data
+   */
+  inline void 
+  operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData);
+
+  /**
+   * We timed out fetching the ndnd ID.
+   * @param interest
+   */
+  inline void 
+  operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest);
+
+private:
+  Buffer &ndndId_;
+  OnSuccess onSuccess_;
+  OnFailure onFailure_;
+};
+
+void 
+NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
+{
+  if (ndndIdData->getSignature().getType() == Signature::SignatureSha256WithRsa)
+    {
+      ndndId_.resize(32);
+      ndn_digestSha256(ndndIdData->getSignature().getValue().value(), ndndIdData->getSignature().getValue().value_size(), ndndId_.buf());
+      onSuccess_();
+    }
+  else
+    onFailure_();
+}
+
+void 
+NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
+{
+  onFailure_();
+}
+
+
+} // namespace ndn
+
+#endif // NDN_NDND_ID_FETCHER_HPP
