diff --git a/ccnx/sync-app-socket.h b/ccnx/sync-app-socket.h
index d17857c..f5e5e0f 100644
--- a/ccnx/sync-app-socket.h
+++ b/ccnx/sync-app-socket.h
@@ -70,6 +70,8 @@
    */
   void remove (const std::string &prefix) {m_syncLogic.remove(prefix);}
 
+  int getSeq();
+
 private:
   CcnxWrapperPtr m_appHandle;
 
diff --git a/ccnx/sync-ccnx-wrapper.cc b/ccnx/sync-ccnx-wrapper.cc
index ea0f876..85ffbd6 100644
--- a/ccnx/sync-ccnx-wrapper.cc
+++ b/ccnx/sync-ccnx-wrapper.cc
@@ -235,18 +235,28 @@
              ccn_upcall_kind kind,
              ccn_upcall_info *info)
 {
-  CcnxWrapper::DataCallback *f = static_cast<CcnxWrapper::DataCallback*> (selfp->data);
+  //CcnxWrapper::DataCallback *f = static_cast<CcnxWrapper::DataCallback*> (selfp->data);
+  ClosurePass *cp = static_cast<ClosurePass *> (selfp->data);
 
   switch (kind)
     {
     case CCN_UPCALL_FINAL:  // effecitve in unit tests
-      delete f;
+      delete cp;
+      cp = NULL;
       delete selfp;
       return CCN_UPCALL_RESULT_OK;
 
     case CCN_UPCALL_CONTENT:
       break;
 
+    case CCN_UPCALL_INTEREST_TIMED_OUT: {
+      if (cp != NULL && cp->getRetry() > 0) {
+        cp->decRetry();
+        return CCN_UPCALL_RESULT_REEXPRESS;
+      }
+      return CCN_UPCALL_RESULT_OK;
+    }
+
     default:
       return CCN_UPCALL_RESULT_OK;
     }
@@ -255,7 +265,6 @@
   size_t len;
   if (ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E], info->pco, (const unsigned char **)&pcontent, &len) < 0)
     BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("decode ContentObject failed"));
-  string content(pcontent, len);
 
   string name;
   for (int i = 0; i < info->content_comps->n - 1; i++)
@@ -267,11 +276,25 @@
       string compStr(comp, size);
       name += compStr;
     }
-  (*f) (name, content);
+
+  cp->runCallback(name, pcontent, len);
+
   return CCN_UPCALL_RESULT_OK;
 }
 
-int CcnxWrapper::sendInterest (const string &strInterest, const DataCallback &dataCallback)
+int CcnxWrapper::sendInterest (const string &strInterest, const DataCallback &dataCallback, int retry)
+{
+  DataClosurePass * pass = new DataClosurePass(STRING_FORM, retry, dataCallback);
+  sendInterest(strInterest, pass);
+}
+
+int CcnxWrapper::sendInterestForRawData (const string &strInterest, const RawDataCallback &rawDataCallback, int retry)
+{
+  RawDataClosurePass * pass = new RawDataClosurePass(RAW_DATA, retry, rawDataCallback);
+  sendInterest(strInterest, pass);
+}
+
+int CcnxWrapper::sendInterest (const string &strInterest, void *dataPass)
 {
   recursive_mutex::scoped_lock lock(m_mutex);
   if (!m_running)
@@ -282,7 +305,7 @@
   ccn_closure *dataClosure = new ccn_closure;
 
   ccn_name_from_uri (pname, strInterest.c_str());
-  dataClosure->data = new DataCallback (dataCallback); // should be removed when closure is removed
+  dataClosure->data = dataPass;
 
   dataClosure->p = &incomingData;
   if (ccn_express_interest (m_handle, pname, dataClosure, NULL) < 0)
@@ -333,4 +356,44 @@
   ccn_charbuf_destroy(&pname);
 }
 
+DataClosurePass::DataClosurePass (CallbackType type, int retry, const CcnxWrapper::DataCallback &dataCallback): ClosurePass(type, retry), m_callback(NULL)
+{
+   m_callback = new CcnxWrapper::DataCallback (dataCallback); 
+}
+
+DataClosurePass::~DataClosurePass () 
+{
+  delete m_callback;
+  m_callback = NULL;
+}
+
+void 
+DataClosurePass::runCallback(std::string name, const char *data, size_t len) 
+{
+  string content(data, len);
+  if (m_callback != NULL) {
+    (*m_callback)(name, content);
+  }
+}
+
+
+RawDataClosurePass::RawDataClosurePass (CallbackType type, int retry, const CcnxWrapper::RawDataCallback &rawDataCallback): ClosurePass(type, retry), m_callback(NULL)
+{
+   m_callback = new CcnxWrapper::RawDataCallback (rawDataCallback); 
+}
+
+RawDataClosurePass::~RawDataClosurePass () 
+{
+  delete m_callback;
+  m_callback = NULL;
+}
+
+void 
+RawDataClosurePass::runCallback(std::string name, const char *data, size_t len) 
+{
+  if (m_callback != NULL) {
+    (*m_callback)(name, data, len);
+  }
+}
+
 }
diff --git a/ccnx/sync-ccnx-wrapper.h b/ccnx/sync-ccnx-wrapper.h
index 0ccbec4..b8c3c93 100644
--- a/ccnx/sync-ccnx-wrapper.h
+++ b/ccnx/sync-ccnx-wrapper.h
@@ -54,6 +54,7 @@
 class CcnxWrapper {
 public:
   typedef boost::function<void (std::string, std::string)> DataCallback;
+  typedef boost::function<void (std::string, const char *buf, size_t len)> RawDataCallback;
   typedef boost::function<void (std::string)> InterestCallback;
   
   /**
@@ -77,7 +78,10 @@
    * @return the return code of ccn_express_interest
    */
   int
-  sendInterest (const std::string &strInterest, const DataCallback &dataCallback);
+  sendInterest (const std::string &strInterest, const DataCallback &dataCallback, int retry = 0);
+
+  int 
+  sendInterestForRawData (const std::string &strInterest, const RawDataCallback &rawDataCallback, int retry = 0);
 
   /**
    * @brief set Interest filter (specify what interest you want to receive)
@@ -127,6 +131,9 @@
 
   void
   ccnLoop ();
+
+  int 
+  sendInterest (const std::string &strInterest, void *dataPass);
   /// @endcond
 private:
   ccn* m_handle;
@@ -140,6 +147,40 @@
 
 typedef boost::shared_ptr<CcnxWrapper> CcnxWrapperPtr;
 
+enum CallbackType { STRING_FORM, RAW_DATA};
+
+class ClosurePass {
+public:
+  ClosurePass(CallbackType type, int retry): m_type(type), m_retry(retry) {}
+  int getRetry() {return m_retry;}
+  void decRetry() { m_retry--;}
+  CallbackType getCallbackType() {return m_type;}
+  virtual ~ClosurePass(){}
+  virtual void runCallback(std::string name, const char *data, size_t len) = 0;
+
+protected:
+  int m_retry;
+  CallbackType m_type;
+};
+
+class DataClosurePass: public ClosurePass {
+public:
+  DataClosurePass(CallbackType type, int retry, const CcnxWrapper::DataCallback &dataCallback);
+  virtual ~DataClosurePass();
+  virtual void runCallback(std::string name, const char *, size_t len);
+private:
+  CcnxWrapper::DataCallback * m_callback;  
+};
+
+class RawDataClosurePass: public ClosurePass {
+public:
+  RawDataClosurePass(CallbackType type, int retry, const CcnxWrapper::RawDataCallback &RawDataCallback);
+  virtual ~RawDataClosurePass();
+  virtual void runCallback(std::string name, const char *, size_t len);
+private:
+  CcnxWrapper::RawDataCallback * m_callback;  
+};
+
 } // Sync
 
 #endif // SYNC_CCNX_WRAPPER_H
diff --git a/demo/chatdialog.cpp b/demo/chatdialog.cpp
index 9fbe15e..9dac70b 100644
--- a/demo/chatdialog.cpp
+++ b/demo/chatdialog.cpp
@@ -76,3 +76,4 @@
   time_t seconds = time(NULL);
   msg.set_timestamp(seconds);
 }
+
