diff --git a/src/ccnx-closure.cpp b/src/ccnx-closure.cpp
new file mode 100644
index 0000000..43b0d65
--- /dev/null
+++ b/src/ccnx-closure.cpp
@@ -0,0 +1,45 @@
+#include "ccnx-closure.h"
+
+namespace Ccnx {
+
+Closure::Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback)
+              : m_retry(retry), m_timeoutCallback(NULL)
+{
+  m_timeoutCallback = new TimeoutCallback (timeoutCallback);
+  m_dataCallback = new DataCallback (dataCallback); 
+}
+
+Closure::Closure(const Closure &other)
+{
+  Closure(other.m_retry, *(other.m_dataCallback), *(other.m_timeoutCallback));
+}
+
+Closure::~Closure () 
+{
+  delete m_dataCallback;
+  delete m_timeoutCallback;
+  m_dataCallback = NULL;
+  m_timeoutCallback = NULL;
+}
+
+Closure::TimeoutCallbackReturnValue 
+Closure::runTimeoutCallback(const string &interest)
+{
+  if ((*m_timeoutCallback).empty())
+  {
+    return RESULT_OK;
+  }
+  
+  return (*m_timeoutCallback)(interest);
+}
+
+
+void 
+Closure::runDataCallback(const string &name, const Bytes &content) 
+{
+  if (m_dataCallback != NULL) {
+    (*m_dataCallback)(name, content);
+  }
+}
+
+} // Ccnx
diff --git a/src/ccnx-pco.cpp b/src/ccnx-pco.cpp
index e2db766..df3bd06 100644
--- a/src/ccnx-pco.cpp
+++ b/src/ccnx-pco.cpp
@@ -16,7 +16,7 @@
 
 ParsedContentObject::ParsedContentObject(const Bytes &bytes)
 {
-  ParsedContentObject((const unsigned char *)bytes[0], bytes.size());
+  ParsedContentObject(head(bytes), bytes.size());
 }
 
 ParsedContentObject::ParsedContentObject(const ParsedContentObject &other)
@@ -36,7 +36,7 @@
   const unsigned char *content;
   size_t len;
   Bytes bytes;
-  int res = ccn_content_get_value((const unsigned char *)m_bytes[0], m_pco.offset[CCN_PCO_E], &m_pco, &content, &len);
+  int res = ccn_content_get_value(head(m_bytes), m_pco.offset[CCN_PCO_E], &m_pco, &content, &len);
   if (res < 0)
   {
     boost::throw_exception(MisformedContentObjectException());
@@ -49,7 +49,7 @@
 string
 ParsedContentObject::name() const
 {
-  return CcnxWrapper::extractName((const unsigned char *)m_bytes[0], m_comps);
+  return CcnxWrapper::extractName(head(m_bytes), m_comps);
 }
 
 }
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index f12e2d5..467f7a1 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -28,28 +28,28 @@
 }
 
 int
-CcnxTunnel::sendInterest (const std::string &interest, const DataCallback &dataCallback, int retry, const TimeoutCallback &timeoutCallback)
+CcnxTunnel::sendInterest (const std::string &interest, Closure *closure)
 {
   string tunneledInterest = queryRoutableName(interest);
-  ClosurePass *cp = new TunnelClosurePass(retry, dataCallback, timeoutCallback, this, interest);
-  CcnxWrapper::sendInterest(tunneledInterest, cp);
+  Closure *cp = new TunnelClosure(closure, this, interest);
+  sendInterest(tunneledInterest, cp);
 }
 
 void 
-CcnxTunnel::handleTunneledData(const string &name, const Bytes &tunneledData, const DataCallback &originalDataCallback)
+CcnxTunnel::handleTunneledData(const string &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback)
 {
   ParsedContentObject pco(tunneledData);
   originalDataCallback(pco.name(), pco.content());
 }
 
 int
-CcnxTunnel::publishData(const string &name, const char *buf, size_t len, int freshness)
+CcnxTunnel::publishData(const string &name, const unsigned char *buf, size_t len, int freshness)
 {
   Bytes content = createContentObject(name, buf, len, freshness);
   storeContentObject(name, content);
   
   string tunneledName = m_localPrefix + name;
-  Bytes tunneledCo = createContentObject(tunneledName, (const char*)&content[0], content.size(), freshness);
+  Bytes tunneledCo = createContentObject(tunneledName, head(content), content.size(), freshness);
 
   return putToCcnd(tunneledCo);
 }
@@ -108,15 +108,21 @@
   m_rit.erase(prefix);
 }
 
-TunnelClosurePass::TunnelClosurePass(int retry, const CcnxWrapper::DataCallback &dataCallback, const CcnxWrapper::TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const string &originalInterest)
-                  : ClosurePass(retry, dataCallback, timeoutCallback)
+TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const string &originalInterest)
+                  : Closure(retry, dataCallback, timeoutCallback)
                   , m_tunnel(tunnel)
                   , m_originalInterest(originalInterest)
 {
 }
 
+TunnelClosure::TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const string &originalInterest)
+                 : Closure(*closure)
+                 , m_tunnel(tunnel)
+{
+}
+
 void 
-TunnelClosurePass::runDataCallback(const string &name, const Bytes &content)
+TunnelClosure::runDataCallback(const string &name, const Bytes &content)
 {
   if (m_tunnel != NULL)
   {
@@ -124,10 +130,10 @@
   }
 }
 
-CcnxWrapper::TimeoutCallbackReturnValue
-TunnelClosurePass::runTimeoutCallback(const string &interest)
+Closure::TimeoutCallbackReturnValue
+TunnelClosure::runTimeoutCallback(const string &interest)
 {
-  return ClosurePass::runTimeoutCallback(m_originalInterest);
+  return Closure::runTimeoutCallback(m_originalInterest);
 }
 
 } // Ccnx
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index 7549e3a..0710c67 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -26,6 +26,11 @@
   }
 }
 
+const unsigned char *
+head(const Bytes &bytes)
+{
+  return &bytes[0];
+}
 
 CcnxWrapper::CcnxWrapper()
   : m_handle (0)
@@ -207,7 +212,7 @@
 }
 
 Bytes
-CcnxWrapper::createContentObject(const std::string &name, const char *buf, size_t len, int freshness)
+CcnxWrapper::createContentObject(const std::string &name, const unsigned char *buf, size_t len, int freshness)
 {
   ccn_charbuf *pname = ccn_charbuf_create();
   ccn_charbuf *signed_info = ccn_charbuf_create();
@@ -223,7 +228,7 @@
 			 NULL,
 			 m_keyLoactor);
   if(ccn_encode_ContentObject(content, pname, signed_info,
-			   (const unsigned char *)buf, len,
+			   buf, len,
 			   NULL, getPrivateKey()) < 0)
   {
     // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("encode content failed"));
@@ -247,7 +252,7 @@
     return -1;
   
 
-  if (ccn_put(m_handle, (const unsigned char *)contentObject[0], contentObject.size()) < 0)
+  if (ccn_put(m_handle, head(contentObject), contentObject.size()) < 0)
   {
     // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("ccnput failed"));
   }
@@ -256,7 +261,7 @@
 }
 
 int
-CcnxWrapper::publishData (const string &name, const char *buf, size_t len, int freshness)
+CcnxWrapper::publishData (const string &name, const unsigned char *buf, size_t len, int freshness)
 {
   Bytes co = createContentObject(name, buf, len, freshness); 
   return putToCcnd(co);
@@ -265,7 +270,7 @@
 int
 CcnxWrapper::publishData (const string &name, const Bytes &content, int freshness)
 {
-  publishData(name, (const char*)content[0], content.size(), freshness);
+  publishData(name, head(content), content.size(), freshness);
 }
 
 string
@@ -318,7 +323,7 @@
              ccn_upcall_kind kind,
              ccn_upcall_info *info)
 {
-  ClosurePass *cp = static_cast<ClosurePass *> (selfp->data);
+  Closure *cp = static_cast<Closure *> (selfp->data);
 
   switch (kind)
     {
@@ -338,11 +343,11 @@
       }
 
       string interest = CcnxWrapper::extractName(info->interest_ccnb, info->interest_comps);
-      CcnxWrapper::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
+      Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
       switch(rv)
       {
-        case CcnxWrapper::RESULT_OK : return CCN_UPCALL_RESULT_OK;
-        case CcnxWrapper::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
+        case Closure::RESULT_OK : return CCN_UPCALL_RESULT_OK;
+        case Closure::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
         default : break;
       }
       return CCN_UPCALL_RESULT_OK;
@@ -371,14 +376,7 @@
   return CCN_UPCALL_RESULT_OK;
 }
 
-
-int CcnxWrapper::sendInterest (const string &strInterest, const DataCallback &dataCallback, int retry, const TimeoutCallback &timeoutCallback)
-{
-  ClosurePass * pass = new ClosurePass(retry, dataCallback, timeoutCallback);
-  sendInterest(strInterest, pass);
-}
-
-int CcnxWrapper::sendInterest (const string &strInterest, void *dataPass)
+int CcnxWrapper::sendInterest (const string &strInterest, Closure *closure)
 {
   recursive_mutex::scoped_lock lock(m_mutex);
   if (!m_running || !m_connected)
@@ -388,7 +386,7 @@
   ccn_closure *dataClosure = new ccn_closure;
 
   ccn_name_from_uri (pname, strInterest.c_str());
-  dataClosure->data = dataPass;
+  dataClosure->data = (void *)closure;
 
   dataClosure->p = &incomingData;
   if (ccn_express_interest (m_handle, pname, dataClosure, NULL) < 0)
@@ -521,40 +519,4 @@
   return retval;
 }
 
-
-ClosurePass::ClosurePass(int retry, const CcnxWrapper::DataCallback &dataCallback, const CcnxWrapper::TimeoutCallback &timeoutCallback)
-              : m_retry(retry), m_timeoutCallback(NULL)
-{
-  m_timeoutCallback = new CcnxWrapper::TimeoutCallback (timeoutCallback);
-  m_dataCallback = new CcnxWrapper::DataCallback (dataCallback); 
-}
-
-ClosurePass::~ClosurePass () 
-{
-  delete m_dataCallback;
-  delete m_timeoutCallback;
-  m_dataCallback = NULL;
-  m_timeoutCallback = NULL;
-}
-
-CcnxWrapper::TimeoutCallbackReturnValue
-ClosurePass::runTimeoutCallback(const string &interest)
-{
-  if ((*m_timeoutCallback).empty())
-  {
-    return CcnxWrapper::RESULT_OK;
-  }
-  
-  return (*m_timeoutCallback)(interest);
-}
-
-
-void 
-ClosurePass::runDataCallback(const string &name, const Bytes &content) 
-{
-  if (m_dataCallback != NULL) {
-    (*m_dataCallback)(name, content);
-  }
-}
-
 }
