Small changes here and there
diff --git a/model/sync-ccnx-wrapper.cc b/model/sync-ccnx-wrapper.cc
index 0acde7f..b901a43 100644
--- a/model/sync-ccnx-wrapper.cc
+++ b/model/sync-ccnx-wrapper.cc
@@ -45,50 +45,58 @@
 {
   m_running = false;
   m_thread.join();
-  ccn_disconnect(m_handle);
-  ccn_destroy(&m_handle);
-  ccn_charbuf_destroy(&m_keyLoactor);
-  ccn_keystore_destroy(&m_keyStore);
+  ccn_disconnect (m_handle);
+  ccn_destroy (&m_handle);
+  ccn_charbuf_destroy (&m_keyLoactor);
+  ccn_keystore_destroy (&m_keyStore);
 }
 
-void CcnxWrapper::createKeyLocator()
+/// @cond include_hidden
+
+void
+CcnxWrapper::createKeyLocator ()
 {
   m_keyLoactor = ccn_charbuf_create();
-  ccn_charbuf_append_tt(m_keyLoactor, CCN_DTAG_KeyLocator, CCN_DTAG);
-  ccn_charbuf_append_tt(m_keyLoactor, CCN_DTAG_Key, CCN_DTAG);
-  int res = ccn_append_pubkey_blob(m_keyLoactor, ccn_keystore_public_key(m_keyStore));
+  ccn_charbuf_append_tt (m_keyLoactor, CCN_DTAG_KeyLocator, CCN_DTAG);
+  ccn_charbuf_append_tt (m_keyLoactor, CCN_DTAG_Key, CCN_DTAG);
+  int res = ccn_append_pubkey_blob (m_keyLoactor, ccn_keystore_public_key(m_keyStore));
   if (res >= 0)
     {
-      ccn_charbuf_append_closer(m_keyLoactor); /* </Key> */
-      ccn_charbuf_append_closer(m_keyLoactor); /* </KeyLocator> */
+      ccn_charbuf_append_closer (m_keyLoactor); /* </Key> */
+      ccn_charbuf_append_closer (m_keyLoactor); /* </KeyLocator> */
     }
 }
 
-const ccn_pkey* CcnxWrapper::getPrivateKey()
+const ccn_pkey*
+CcnxWrapper::getPrivateKey ()
 {
-  return ccn_keystore_private_key(m_keyStore);
+  return ccn_keystore_private_key (m_keyStore);
 }
 
-const unsigned char* CcnxWrapper::getPublicKeyDigest()
+const unsigned char*
+CcnxWrapper::getPublicKeyDigest ()
 {
   return ccn_keystore_public_key_digest(m_keyStore);
 }
 
-ssize_t CcnxWrapper::getPublicKeyDigestLength()
+ssize_t
+CcnxWrapper::getPublicKeyDigestLength ()
 {
   return ccn_keystore_public_key_digest_length(m_keyStore);
 }
 
-void CcnxWrapper::initKeyStore()
+void
+CcnxWrapper::initKeyStore ()
 {
-  ccn_charbuf *temp = ccn_charbuf_create();
-  m_keyStore = ccn_keystore_create();
-  ccn_charbuf_putf(temp, "%s/.ccnx/.ccnx_keystore", getenv("HOME"));
-  ccn_keystore_init(m_keyStore, ccn_charbuf_as_string(temp), (char*)"Th1s1sn0t8g00dp8ssw0rd.");
-  ccn_charbuf_destroy(&temp);
+  ccn_charbuf *temp = ccn_charbuf_create ();
+  m_keyStore = ccn_keystore_create ();
+  ccn_charbuf_putf (temp, "%s/.ccnx/.ccnx_keystore", getenv("HOME"));
+  ccn_keystore_init (m_keyStore, ccn_charbuf_as_string(temp), (char*)"Th1s1sn0t8g00dp8ssw0rd.");
+  ccn_charbuf_destroy (&temp);
 }
 
-void CcnxWrapper::ccnLoop()
+void
+CcnxWrapper::ccnLoop ()
 {
   pollfd pfds[1];
   int res = ccn_run(m_handle, 0);
@@ -110,7 +118,10 @@
     }
 }
 
-int CcnxWrapper::publishData(string name, string dataBuffer, int freshness)
+/// @endcond
+
+int
+CcnxWrapper::publishData (const string &name, const string &dataBuffer, int freshness)
 {
   ccn_charbuf *pname = ccn_charbuf_create();
   ccn_charbuf *signed_info = ccn_charbuf_create();
@@ -126,27 +137,28 @@
 			 NULL,
 			 m_keyLoactor);
   ccn_encode_ContentObject(content, pname, signed_info,
-			   dataBuffer.c_str(), dataBuffer.length(),
+			   dataBuffer.c_str(), dataBuffer.length (),
 			   NULL, getPrivateKey());
   recursive_mutex::scoped_lock lock(m_mutex);
   ccn_put(m_handle, content->buf, content->length);
 
-  ccn_charbuf_destroy(&pname);
-  ccn_charbuf_destroy(&signed_info);
-  ccn_charbuf_destroy(&content);
+  ccn_charbuf_destroy (&pname);
+  ccn_charbuf_destroy (&signed_info);
+  ccn_charbuf_destroy (&content);
 }
 
 
-static ccn_upcall_res incomingInterest(
-                                       ccn_closure *selfp,
-                                       ccn_upcall_kind kind,
-                                       ccn_upcall_info *info)
+static ccn_upcall_res
+incomingInterest(ccn_closure *selfp,
+                 ccn_upcall_kind kind,
+                 ccn_upcall_info *info)
 {
-  function<void (string)> f = *(function<void (string)> *)selfp->data;
+  CcnxWrapper::InterestCallback *f = static_cast<CcnxWrapper::InterestCallback*> (selfp->data);
 
   switch (kind)
     {
     case CCN_UPCALL_FINAL:
+      delete f;
       delete selfp;
       return CCN_UPCALL_RESULT_OK;
 
@@ -166,20 +178,21 @@
       ccn_name_comp_get(info->interest_ccnb, info->interest_comps, i, (const unsigned char **)&comp, &size);
       interest += comp;
     }
-  f(interest);
+  (*f) (interest);
   return CCN_UPCALL_RESULT_OK;
 }
 
-static ccn_upcall_res incomingData(
-                                   ccn_closure *selfp,
-                                   ccn_upcall_kind kind,
-                                   ccn_upcall_info *info)
+static ccn_upcall_res
+incomingData(ccn_closure *selfp,
+             ccn_upcall_kind kind,
+             ccn_upcall_info *info)
 {
-  function<void (string, string)> f = *(function<void (string, string)> *)selfp->data;
+  CcnxWrapper::DataCallback *f = static_cast<CcnxWrapper::DataCallback*> (selfp->data);
 
   switch (kind)
     {
     case CCN_UPCALL_FINAL:
+      delete f; // this never called in unit tests... 
       delete selfp;
       return CCN_UPCALL_RESULT_OK;
 
@@ -203,35 +216,34 @@
       name += comp; // this will also crash if name doesn't have \0 ending
     }
   // this will crash when content doesn't have \0 ending
-  f(name, (string)pcontent);
+  (*f) (name, (string)pcontent);
   return CCN_UPCALL_RESULT_OK;
 }
 
-int CcnxWrapper::sendInterest(string strInterest, function<void (string, string)> dataCallback)
+int CcnxWrapper::sendInterest (const string &strInterest, const DataCallback &dataCallback)
 {
   ccn_charbuf *pname = ccn_charbuf_create();
   ccn_closure *dataClosure = new ccn_closure;
-  function<void (string, string)> *f = new function<void (string, string)>(dataCallback);
-
-  ccn_name_from_uri(pname, strInterest.c_str());
-  dataClosure->data = f;
+  
+  ccn_name_from_uri (pname, strInterest.c_str());
+  dataClosure->data = new DataCallback (dataCallback); // should be removed when closure is removed
+  
   dataClosure->p = &incomingData;
   recursive_mutex::scoped_lock lock(m_mutex);
-  ccn_express_interest(m_handle, pname, dataClosure, NULL);
+  ccn_express_interest (m_handle, pname, dataClosure, NULL);
 
-  ccn_charbuf_destroy(&pname);
+  ccn_charbuf_destroy (&pname);
 }
 
-int CcnxWrapper::setInterestFilter(string prefix, function<void (string)> interestCallback)
+int CcnxWrapper::setInterestFilter (const string &prefix, const InterestCallback &interestCallback)
 {
   ccn_charbuf *pname = ccn_charbuf_create();
   ccn_closure *interestClosure = new ccn_closure;
-  function<void (string)> *f = new function<void (string)>(interestCallback);
 
-  ccn_name_from_uri(pname, prefix.c_str());
-  interestClosure->data = f;
+  ccn_name_from_uri (pname, prefix.c_str());
+  interestClosure->data = new InterestCallback (interestCallback); // should be removed when closure is removed
   interestClosure->p = &incomingInterest;
-  ccn_set_interest_filter(m_handle, pname, interestClosure);
+  ccn_set_interest_filter (m_handle, pname, interestClosure);
 
   ccn_charbuf_destroy(&pname);
 }