diff --git a/src/ccnx-closure.cpp b/src/ccnx-closure.cpp
index 5b24f66..5b30244 100644
--- a/src/ccnx-closure.cpp
+++ b/src/ccnx-closure.cpp
@@ -23,7 +23,7 @@
 }
 
 Closure::TimeoutCallbackReturnValue
-Closure::runTimeoutCallback(const string &interest)
+Closure::runTimeoutCallback(const Name &interest)
 {
   if ((*m_timeoutCallback).empty())
   {
@@ -35,7 +35,7 @@
 
 
 void
-Closure::runDataCallback(const string &name, const Bytes &content)
+Closure::runDataCallback(const Name &name, const Bytes &content)
 {
   if (m_dataCallback != NULL) {
     (*m_dataCallback)(name, content);
diff --git a/src/ccnx-name.cpp b/src/ccnx-name.cpp
index bc7b9bd..ce5f270 100644
--- a/src/ccnx-name.cpp
+++ b/src/ccnx-name.cpp
@@ -4,6 +4,7 @@
 #include <boost/algorithm/string/join.hpp>
 
 namespace Ccnx{
+CcnxCharbufPtr CcnxCharbuf::Null;
 
 CcnxCharbuf::CcnxCharbuf()
             : m_buf(NULL)
@@ -66,6 +67,40 @@
   }
 }
 
+Name &
+Name::operator=(const Name &other)
+{
+  m_comps = other.m_comps;
+  return *this;
+}
+bool
+Name::operator==(const string &str)
+{
+  return this->toString() == str;
+}
+
+bool
+Name::operator!=(const string &str)
+{
+  return !(*this == str);
+}
+
+Name
+operator+(const Name &n1, const Name &n2)
+{
+  vector<Bytes> comps = n1.m_comps;
+  copy(n2.m_comps.begin(), n2.m_comps.end(), back_inserter(comps));
+  return Name(comps);
+}
+
+string
+Name::toString() const
+{
+  stringstream ss(stringstream::out);
+  ss << *this;
+  return ss.str();
+}
+
 CcnxCharbufPtr
 Name::toCcnxCharbuf() const
 {
@@ -131,7 +166,7 @@
 Name::getPartialName(int start, int n) const
 {
   int size = m_comps.size();
-  if (start < 0 || start >= size || start + n > size)
+  if (start < 0 || start >= size || n > 0 && start + n > size)
   {
     stringstream ss(stringstream::out);
     ss << "getPartialName() parameter out of range! ";
@@ -142,10 +177,21 @@
   }
 
   vector<Bytes> comps;
-  for (int i = 0; i < n; i++)
+  int end;
+  if (n > 0)
   {
-    comps.push_back(m_comps[start + i]);
+    end = start + n;
   }
+  else
+  {
+    end = size;
+  }
+
+  for (int i = start; i < end; i++)
+  {
+    comps.push_back(m_comps[i]);
+  }
+
   return Name(comps);
 }
 
@@ -163,6 +209,31 @@
   return os;
 }
 
+bool
+operator ==(const Name &n1, const Name &n2)
+{
+  stringstream ss1(stringstream::out);
+  stringstream ss2(stringstream::out);
+  ss1 << n1;
+  ss2 << n2;
+  return ss1.str() == ss2.str();
+}
+
+bool
+operator !=(const Name &n1, const Name &n2)
+{
+  return !(n1 == n2);
+}
+
+bool
+operator <(const Name &n1, const Name &n2)
+{
+  stringstream ss1(stringstream::out);
+  stringstream ss2(stringstream::out);
+  ss1 << n1;
+  ss2 << n2;
+  return ss1.str() < ss2.str();
+}
 
 Selectors::Selectors()
           : m_maxSuffixComps(-1)
@@ -185,9 +256,36 @@
   m_publisherPublicKeyDigest = other.m_publisherPublicKeyDigest;
 }
 
-CcnxCharbufPtr
-Selectors::toCcnxCharbuf()
+bool
+Selectors::operator == (const Selectors &other)
 {
+  return m_maxSuffixComps == other.m_maxSuffixComps
+         && m_minSuffixComps == other.m_minSuffixComps
+         && m_answerOriginKind == other.m_answerOriginKind
+         && (m_interestLifetime - other.m_interestLifetime) < 10e-4
+         && m_scope == other.m_scope
+         && m_childSelector == other.m_childSelector;
+}
+
+bool
+Selectors::isEmpty() const
+{
+  return m_maxSuffixComps == -1
+         && m_minSuffixComps == -1
+         && m_answerOriginKind == AOK_DEFAULT
+         && (m_interestLifetime - (-1.0)) < 10e-4
+         && m_scope == -1
+         && m_childSelector == DEFAULT;
+}
+
+
+CcnxCharbufPtr
+Selectors::toCcnxCharbuf() const
+{
+  if (isEmpty())
+  {
+    return CcnxCharbuf::Null;
+  }
   CcnxCharbufPtr ptr(new CcnxCharbuf());
   ccn_charbuf *cbuf = ptr->getBuf();
   ccn_charbuf_append_tt(cbuf, CCN_DTAG_Interest, CCN_DTAG);
diff --git a/src/ccnx-pco.cpp b/src/ccnx-pco.cpp
index 1c24891..dce3bcb 100644
--- a/src/ccnx-pco.cpp
+++ b/src/ccnx-pco.cpp
@@ -46,10 +46,10 @@
   return bytes;
 }
 
-string
+Name
 ParsedContentObject::name() const
 {
-  return CcnxWrapper::extractName(head(m_bytes), m_comps);
+  return Name(head(m_bytes), m_comps);
 }
 
 }
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index 037bd8a..49e28af 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -18,8 +18,8 @@
 void
 CcnxTunnel::refreshLocalPrefix()
 {
-  string newPrefix = getLocalPrefix();
-  if (!newPrefix.empty() && m_localPrefix != newPrefix)
+  Name newPrefix = getLocalPrefix();
+  if (!newPrefix.toString().empty() && m_localPrefix != newPrefix)
   {
     CcnxWrapper::clearInterestFilter(m_localPrefix);
     CcnxWrapper::setInterestFilter(newPrefix, bind(&CcnxTunnel::handleTunneledInterest, this, _1));
@@ -28,23 +28,22 @@
 }
 
 int
-CcnxTunnel::sendInterest (const string &interest, Closure *closure)
+CcnxTunnel::sendInterest (const Name &interest, Closure *closure, const Selectors &selectors)
 {
-  string strInterest = interest;
-  string tunneledInterest = queryRoutableName(strInterest);
-  Closure *cp = new TunnelClosure(closure, this, strInterest);
-  sendInterest(tunneledInterest, cp);
+  Name tunneledInterest = queryRoutableName(interest);
+  Closure *cp = new TunnelClosure(closure, this, interest);
+  sendInterest(tunneledInterest, cp, selectors);
 }
 
 void
-CcnxTunnel::handleTunneledData(const string &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback)
+CcnxTunnel::handleTunneledData(const Name &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback)
 {
   ParsedContentObject pco(tunneledData);
   originalDataCallback(pco.name(), pco.content());
 }
 
 int
-CcnxTunnel::publishData(const string &name, const unsigned char *buf, size_t len, int freshness)
+CcnxTunnel::publishData(const Name &name, const unsigned char *buf, size_t len, int freshness)
 {
   Bytes content = createContentObject(name, buf, len, freshness);
   storeContentObject(name, content);
@@ -53,20 +52,18 @@
 }
 
 int
-CcnxTunnel::publishContentObject(const string &name, const Bytes &contentObject, int freshness)
+CcnxTunnel::publishContentObject(const Name &name, const Bytes &contentObject, int freshness)
 {
-  string tunneledName = m_localPrefix + name;
+  Name tunneledName = m_localPrefix + name;
   Bytes tunneledCo = createContentObject(tunneledName, head(contentObject), contentObject.size(), freshness);
   return putToCcnd(tunneledCo);
 }
 
 void
-CcnxTunnel::handleTunneledInterest(const string &tunneledInterest)
+CcnxTunnel::handleTunneledInterest(const Name &tunneledInterest)
 {
   // The interest must have m_localPrefix as a prefix (component-wise), otherwise ccnd would not deliver it to us
-  string interest = (m_localPrefix == "/")
-                    ? tunneledInterest
-                    : tunneledInterest.substr(m_localPrefix.size());
+  Name interest = tunneledInterest.getPartialName(m_localPrefix.size());
 
   ReadLock(m_ritLock);
 
@@ -82,23 +79,27 @@
 }
 
 bool
-CcnxTunnel::isPrefix(const string &prefix, const string &name)
+CcnxTunnel::isPrefix(const Name &prefix, const Name &name)
 {
-  // prefix is literally prefix of name
-  if (name.find(prefix) == 0)
+  if (prefix.size() > name.size())
   {
-    // name and prefix are exactly the same, or the next character in name
-    // is '/'; in both case, prefix is the ccnx prefix of name (component-wise)
-    if (name.size() == prefix.size() || name.at(prefix.size()) == '/')
+    return false;
+  }
+
+  int size = prefix.size();
+  for (int i = 0; i < size; i++)
+  {
+    if (prefix.getCompAsString(i) != name.getCompAsString(i))
     {
-      return true;
+      return false;
     }
   }
-  return false;
+
+  return true;
 }
 
 int
-CcnxTunnel::setInterestFilter(const string &prefix, const InterestCallback &interestCallback)
+CcnxTunnel::setInterestFilter(const Name &prefix, const InterestCallback &interestCallback)
 {
   WriteLock(m_ritLock);
   // make sure copy constructor for boost::function works properly
@@ -107,28 +108,28 @@
 }
 
 void
-CcnxTunnel::clearInterestFilter(const string &prefix)
+CcnxTunnel::clearInterestFilter(const Name &prefix)
 {
   WriteLock(m_ritLock);
   // remove all
   m_rit.erase(prefix);
 }
 
-TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const string &originalInterest)
+TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const Name &originalInterest)
                   : Closure(retry, dataCallback, timeoutCallback)
                   , m_tunnel(tunnel)
                   , m_originalInterest(originalInterest)
 {
 }
 
-TunnelClosure::TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const string &originalInterest)
+TunnelClosure::TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const Name &originalInterest)
                  : Closure(*closure)
                  , m_tunnel(tunnel)
 {
 }
 
 void
-TunnelClosure::runDataCallback(const string &name, const Bytes &content)
+TunnelClosure::runDataCallback(const Name &name, const Bytes &content)
 {
   if (m_tunnel != NULL)
   {
@@ -137,7 +138,7 @@
 }
 
 Closure::TimeoutCallbackReturnValue
-TunnelClosure::runTimeoutCallback(const string &interest)
+TunnelClosure::runTimeoutCallback(const Name &interest)
 {
   return Closure::runTimeoutCallback(m_originalInterest);
 }
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index 1980e6e..ac65cba 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -63,7 +63,7 @@
 
   if (!m_registeredInterests.empty())
   {
-    for (map<std::string, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
+    for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
     {
       // clearInterestFilter(it->first);
       setInterestFilter(it->first, it->second);
@@ -211,13 +211,13 @@
 }
 
 Bytes
-CcnxWrapper::createContentObject(const std::string &name, const unsigned char *buf, size_t len, int freshness)
+CcnxWrapper::createContentObject(const Name  &name, const unsigned char *buf, size_t len, int freshness)
 {
-  ccn_charbuf *pname = ccn_charbuf_create();
+  CcnxCharbufPtr ptr = name.toCcnxCharbuf();
+  ccn_charbuf *pname = ptr->getBuf();
   ccn_charbuf *signed_info = ccn_charbuf_create();
   ccn_charbuf *content = ccn_charbuf_create();
 
-  ccn_name_from_uri(pname, name.c_str());
   ccn_signed_info_create(signed_info,
 			 getPublicKeyDigest(),
 			 getPublicKeyDigestLength(),
@@ -236,7 +236,6 @@
   Bytes bytes;
   readRaw(bytes, content->buf, content->length);
 
-  ccn_charbuf_destroy (&pname);
   ccn_charbuf_destroy (&signed_info);
   ccn_charbuf_destroy (&content);
 
@@ -260,35 +259,18 @@
 }
 
 int
-CcnxWrapper::publishData (const string &name, const unsigned char *buf, size_t len, int freshness)
+CcnxWrapper::publishData (const Name &name, const unsigned char *buf, size_t len, int freshness)
 {
   Bytes co = createContentObject(name, buf, len, freshness);
   return putToCcnd(co);
 }
 
 int
-CcnxWrapper::publishData (const string &name, const Bytes &content, int freshness)
+CcnxWrapper::publishData (const Name &name, const Bytes &content, int freshness)
 {
   publishData(name, head(content), content.size(), freshness);
 }
 
-string
-CcnxWrapper::extractName(const unsigned char *data, const ccn_indexbuf *comps)
-{
-  ostringstream name (ostringstream::out);
-  for (int i = 0; i < comps->n - 1; i++)
-  {
-    char *comp;
-    size_t size;
-    name << "/";
-    ccn_name_comp_get(data, comps, i, (const unsigned char **)&comp, &size);
-    string compStr(comp, size);
-    name << compStr;
-  }
-
-  return name.str();
-}
-
 
 static ccn_upcall_res
 incomingInterest(ccn_closure *selfp,
@@ -311,7 +293,7 @@
       return CCN_UPCALL_RESULT_OK;
     }
 
-  string interest = CcnxWrapper::extractName(info->interest_ccnb, info->interest_comps);
+  Name interest(info->interest_ccnb, info->interest_comps);
 
   (*f) (interest);
   return CCN_UPCALL_RESULT_OK;
@@ -341,7 +323,7 @@
         return CCN_UPCALL_RESULT_REEXPRESS;
       }
 
-      string interest = CcnxWrapper::extractName(info->interest_ccnb, info->interest_comps);
+      Name interest(info->interest_ccnb, info->interest_comps);
       Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
       switch(rv)
       {
@@ -363,7 +345,7 @@
     // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("decode ContentObject failed"));
   }
 
-  string name = CcnxWrapper::extractName(info->content_ccnb, info->content_comps);
+  Name name(info->content_ccnb, info->content_comps);
 
   Bytes content;
   // copy content and do processing on the copy
@@ -375,37 +357,44 @@
   return CCN_UPCALL_RESULT_OK;
 }
 
-int CcnxWrapper::sendInterest (const string &interest, Closure *closure)
+int CcnxWrapper::sendInterest (const Name &interest, Closure *closure, const Selectors &selectors)
 {
   UniqueRecLock(m_mutex);
   if (!m_running || !m_connected)
     return -1;
 
-  ccn_charbuf *pname = ccn_charbuf_create();
+  CcnxCharbufPtr namePtr = interest.toCcnxCharbuf();
+  ccn_charbuf *pname = namePtr->getBuf();
   ccn_closure *dataClosure = new ccn_closure;
 
-  ccn_name_from_uri (pname, interest.c_str());
   dataClosure->data = (void *)closure;
 
   dataClosure->p = &incomingData;
-  if (ccn_express_interest (m_handle, pname, dataClosure, NULL) < 0)
+
+  CcnxCharbufPtr selectorsPtr = selectors.toCcnxCharbuf();
+  ccn_charbuf *templ = NULL;
+  if (selectorsPtr != CcnxCharbuf::Null)
+  {
+    templ = selectorsPtr->getBuf();
+  }
+
+  if (ccn_express_interest (m_handle, pname, dataClosure, templ) < 0)
   {
   }
 
-  ccn_charbuf_destroy (&pname);
   return 0;
 }
 
-int CcnxWrapper::setInterestFilter (const string &prefix, const InterestCallback &interestCallback)
+int CcnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback)
 {
   UniqueRecLock(m_mutex);
   if (!m_running || !m_connected)
     return -1;
 
-  ccn_charbuf *pname = ccn_charbuf_create();
+  CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
+  ccn_charbuf *pname = ptr->getBuf();
   ccn_closure *interestClosure = new ccn_closure;
 
-  ccn_name_from_uri (pname, prefix.c_str());
   interestClosure->data = new InterestCallback (interestCallback); // should be removed when closure is removed
   interestClosure->p = &incomingInterest;
   int ret = ccn_set_interest_filter (m_handle, pname, interestClosure);
@@ -413,37 +402,35 @@
   {
   }
 
-  m_registeredInterests.insert(pair<std::string, InterestCallback>(prefix, interestCallback));
-  ccn_charbuf_destroy(&pname);
+  m_registeredInterests.insert(pair<Name, InterestCallback>(prefix, interestCallback));
 }
 
 void
-CcnxWrapper::clearInterestFilter (const std::string &prefix)
+CcnxWrapper::clearInterestFilter (const Name &prefix)
 {
   UniqueRecLock(m_mutex);
   if (!m_running || !m_connected)
     return;
 
-  ccn_charbuf *pname = ccn_charbuf_create();
+  CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
+  ccn_charbuf *pname = ptr->getBuf();
 
-  ccn_name_from_uri (pname, prefix.c_str());
   int ret = ccn_set_interest_filter (m_handle, pname, 0);
   if (ret < 0)
   {
   }
 
   m_registeredInterests.erase(prefix);
-  ccn_charbuf_destroy(&pname);
 }
 
-string
+Name
 CcnxWrapper::getLocalPrefix ()
 {
   struct ccn * tmp_handle = ccn_create ();
   int res = ccn_connect (tmp_handle, NULL);
   if (res < 0)
     {
-      return "";
+      return Name();
     }
 
   string retval = "";
@@ -515,7 +502,7 @@
   ccn_disconnect (tmp_handle);
   ccn_destroy (&tmp_handle);
 
-  return retval;
+  return Name(retval);
 }
 
 }
