diff --git a/js/Interest.js b/js/Interest.js
index ab20de1..46303b1 100644
--- a/js/Interest.js
+++ b/js/Interest.js
@@ -3,20 +3,20 @@
  * This class represents Interest Objects
  */
 
-var Interest = function Interest(_Name,_FaceInstance,_MinSuffixComponents,_MaxSuffixComponents,_PublisherID, _Exclude, _ChildSelector,_AnswerOriginKind,_Scope,_InterestLifetime,_Nonce){
+var Interest = function Interest(_name,_faceInstance,_minSuffixComponents,_maxSuffixComponents,_publisherPublicKeyDigest, _exclude, _childSelector,_answerOriginKind,_scope,_interestLifetime,_nonce){
 		
-	this.Name = _Name;
-	this.FaceInstance = _FaceInstance;
-	this.MaxSuffixComponents = _MaxSuffixComponents;
-	this.MinSuffixComponents = _MinSuffixComponents;
+	this.name = _name;
+	this.faceInstance = _faceInstance;
+	this.maxSuffixComponents = _maxSuffixComponents;
+	this.minSuffixComponents = _minSuffixComponents;
 	
-	this.PublisherID = _PublisherID;
-	this.Exclude = _Exclude;
-	this.ChildSelector = _ChildSelector;
-	this.AnswerOriginKind = _AnswerOriginKind;
-	this.Scope = _Scope;
-	this.InterestLifetime = null;		// For now we don't have the ability to set an interest lifetime
-	this.Nonce = _Nonce;
+	this.publisherPublicKeyDigest = _publisherPublicKeyDigest;
+	this.exclude = _exclude;
+	this.childSelector = _childSelector;
+	this.answerOriginKind = _answerOriginKind;
+	this.scope = _scope;
+	this.interestLifetime = null;		// For now we don't have the ability to set an interest lifetime
+	this.nonce = _nonce;
 	
 
 	this.RECURSIVE_POSTFIX = "*";
@@ -26,99 +26,111 @@
 	this.ANSWER_CONTENT_STORE = 1;
 	this.ANSWER_GENERATED = 2;
 	this.ANSWER_STALE = 4;		// Stale answer OK
-	this.MARK_STALE = 16;		// Must have Scope 0.  Michael calls this a "hack"
+	this.MARK_STALE = 16;		// Must have scope 0.  Michael calls this a "hack"
 
 	this.DEFAULT_ANSWER_ORIGIN_KIND = this.ANSWER_CONTENT_STORE | this.ANSWER_GENERATED;
 
 };
 
-Interest.prototype.decode = function(/*XMLDecoder*/ decoder) {
+Interest.prototype.from_ccnb = function(/*XMLDecoder*/ decoder) {
 
 		decoder.readStartElement(CCNProtocolDTags.Interest);
 
-		this.Name = new ContentName();
-		this.Name.decode(decoder);
+		this.name = new ContentName();
+		this.name.decode(decoder);
 
 		if (decoder.peekStartElement(CCNProtocolDTags.MinSuffixComponents)) {
-			this.MinSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MinSuffixComponents);
+			this.minSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MinSuffixComponents);
 		}
 
 		if (decoder.peekStartElement(CCNProtocolDTags.MaxSuffixComponents)) {
-			this.MaxSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MaxSuffixComponents);
+			this.maxSuffixComponents = decoder.readIntegerElement(CCNProtocolDTags.MaxSuffixComponents);
 		}
 			
-		//TODO decode PublisherID
-		if (PublisherID.peek(decoder)) {
-			this.Publisher = new PublisherID();
-			this.Publisher.decode(decoder);
+		if (decoder.peekStartElement(CCNProtocolDTags.PublisherPublicKeyDigest)) {
+			this.publisherPublicKeyDigest = new PublisherPublicKeyDigest();
+			this.publisherPublicKeyDigest.decode(decoder);
 		}
 
 		if (decoder.peekStartElement(CCNProtocolDTags.Exclude)) {
-			this.Exclude = new Exclude();
-			this.Exclude.decode(decoder);
+			this.exclude = new Exclude();
+			this.exclude.decode(decoder);
 		}
 		
 		if (decoder.peekStartElement(CCNProtocolDTags.ChildSelector)) {
-			this.ChildSelector = decoder.readIntegerElement(CCNProtocolDTags.ChildSelector);
+			this.childSelector = decoder.readIntegerElement(CCNProtocolDTags.ChildSelector);
 		}
 		
 		if (decoder.peekStartElement(CCNProtocolDTags.AnswerOriginKind)) {
 			// call setter to handle defaulting
-			this.AnswerOriginKind = decoder.readIntegerElement(CCNProtocolDTags.AnswerOriginKind);
+			this.answerOriginKind = decoder.readIntegerElement(CCNProtocolDTags.AnswerOriginKind);
 		}
 		
 		if (decoder.peekStartElement(CCNProtocolDTags.Scope)) {
-			this.Scope = decoder.readIntegerElement(CCNProtocolDTags.Scope);
+			this.scope = decoder.readIntegerElement(CCNProtocolDTags.Scope);
 		}
 
 		if (decoder.peekStartElement(CCNProtocolDTags.InterestLifetime)) {
-			this.InterestLifetime = decoder.readBinaryElement(CCNProtocolDTags.InterestLifetime);
+			this.interestLifetime = decoder.readBinaryElement(CCNProtocolDTags.InterestLifetime);
 		}
 		
 		if (decoder.peekStartElement(CCNProtocolDTags.Nonce)) {
-			this.Nonce = decoder.readBinaryElement(CCNProtocolDTags.Nonce);
+			this.nonce = decoder.readBinaryElement(CCNProtocolDTags.Nonce);
 		}
 		
 		decoder.readEndElement();
 };
 
-Interest.prototype.encode = function(/*XMLEncoder*/ encoder){
+Interest.prototype.to_ccnb = function(/*XMLEncoder*/ encoder){
 		//Could check if name is present
 		
 		encoder.writeStartElement(CCNProtocolDTags.Interest);
 		
-		this.Name.encode(encoder);
+		this.name.encode(encoder);
 	
-		if (null != this.MinSuffixComponents) 
-			encoder.writeElement(CCNProtocolDTags.MinSuffixComponents, this.MinSuffixComponents);	
+		if (null != this.minSuffixComponents) 
+			encoder.writeElement(CCNProtocolDTags.MinSuffixComponents, this.minSuffixComponents);	
 
-		if (null != this.MaxSuffixComponents) 
-			encoder.writeElement(CCNProtocolDTags.MaxSuffixComponents, this.MaxSuffixComponents);
+		if (null != this.maxSuffixComponents) 
+			encoder.writeElement(CCNProtocolDTags.MaxSuffixComponents, this.maxSuffixComponents);
 
-		//TODO Encode PublisherID
+		if (null != this.publisherPublicKeyDigest)
+			this.publisherPublicKeyDigest.encode(encoder);
 		
-		if (null != this.PublisherID)
-			publisherID().encode(encoder);
+		if (null != this.exclude)
+			this.exclude.encode(encoder);
 		
-		//TODO Encode Exclude
-		
-		if (null != this.Exclude)
-			exclude().encode(encoder);
-		
-		if (null != this.ChildSelector) 
-			encoder.writeElement(CCNProtocolDTags.ChildSelector, this.ChildSelector);
+		if (null != this.childSelector) 
+			encoder.writeElement(CCNProtocolDTags.ChildSelector, this.childSelector);
 
 		//TODO Encode OriginKind
-		if (this.DEFAULT_ANSWER_ORIGIN_KIND != this.AnswerOriginKind && this.AnswerOriginKind!=null) 
-			encoder.writeElement(CCNProtocolDTags.AnswerOriginKind, this.AnswerOriginKind);
+		if (this.DEFAULT_ANSWER_ORIGIN_KIND != this.answerOriginKind && this.answerOriginKind!=null) 
+			encoder.writeElement(CCNProtocolDTags.AnswerOriginKind, this.answerOriginKind);
 		
-		if (null != this.Scope) 
-			encoder.writeElement(CCNProtocolDTags.Scope, this.Scope);
+		if (null != this.scope) 
+			encoder.writeElement(CCNProtocolDTags.Scope, this.scope);
 		
-		if (null != this.Nonce)
-			encoder.writeElement(CCNProtocolDTags.Nonce, this.Nonce);
+		if (null != this.nonce)
+			encoder.writeElement(CCNProtocolDTags.Nonce, this.nonce);
 		
 		encoder.writeEndElement();
 
 };
 
+Interest.prototype.matches_name = function(/*ContentName*/ name){
+	var i_name = this.name.Components;
+	var o_name = name.Components;
+
+	// The intrest name is longer than the name we are checking it against.
+	if (i_name.length > o_name.length)
+            return false;
+
+	// Check if at least one of given components doesn't match.
+        for (var i = 0; i < i_name.length; ++i) {
+            if (!DataUtils.arraysEqual(i_name[i], o_name[i]))
+                return false;
+        }
+
+	return true;
+}
+
