In expressInterest, call expressInterestHelper.
diff --git a/js/XpcomTransport.js b/js/XpcomTransport.js
index 497494b..98cce30 100644
--- a/js/XpcomTransport.js
+++ b/js/XpcomTransport.js
@@ -25,9 +25,9 @@
 /*
  * Connect to the host and port in ndn.  This replaces a previous connection.
  * Listen on the port to read an entire binary XML encoded element and call
- *    elementListener.onReceivedElement(element) where element is Uint8Array.
+ *    ndn.onReceivedElement(element).
  */
-XpcomTransport.prototype.connect = function(ndn, elementListener) {
+XpcomTransport.prototype.connect = function(ndn) {
     if (this.socket != null) {
         try {
             this.socket.close(0);
@@ -49,7 +49,7 @@
 
     var inStream = this.socket.openInputStream(0, 0, 0);
 	var dataListener = {
-        elementReader: new BinaryXmlElementReader(elementListener),
+        elementReader: new BinaryXmlElementReader(ndn),
 		
 		onStartRequest: function (request, context) {
 		},
@@ -86,91 +86,11 @@
 };
 
 XpcomTransport.prototype.expressInterest = function(ndn, interest, closure) {
-    console.log("expressInterest " + interest.name.to_uri());
     var thisXpcomTransport = this;
     
-    if (this.socket == null || this.connectedHost != ndn.host || this.connectedPort != ndn.port) {
-      var elementListener = {
-		onReceivedElement : function(element) {
-            var decoder = new BinaryXMLDecoder(element);
-            if (decoder.peekStartElement(CCNProtocolDTags.Interest)) {
-                // TODO: handle interest properly. 
-            }
-            else if (decoder.peekStartElement(CCNProtocolDTags.ContentObject)) {
-                var co = new ContentObject();
-                co.from_ccnb(decoder);
-                   					
-				var pitEntry = NDN.getEntryForExpressedInterest(co.name);
-				if (pitEntry != null) {
-					// Remove PIT entry from NDN.PITTable.
-                    // TODO: This needs to be a single thread-safe transaction.
-					var index = NDN.PITTable.indexOf(pitEntry);
-					if (index >= 0)
-						NDN.PITTable.splice(index, 1);
-                }
-   				if (pitEntry != null) {
-					var currentClosure = pitEntry.closure;
-                        
-                    // Cancel interest timer
-                    clearTimeout(pitEntry.timerID);
-                    
-                    // TODO: verify the content object and set kind to UPCALL_CONTENT.
-                    var result = currentClosure.upcall(Closure.UPCALL_CONTENT_UNVERIFIED,
-                                new UpcallInfo(thisXpcomTransport.ndn, null, 0, co));
-                    if (result == Closure.RESULT_OK) {
-                        // success
-                    }
-                    else if (result == Closure.RESULT_ERR)
-                        console.log("XpcomTransport: upcall returned RESULT_ERR.");
-                    else if (result == Closure.RESULT_REEXPRESS) {
-                        // TODO: Handl re-express interest.
-                    }
-                    else if (result == Closure.RESULT_VERIFY) {
-                        // TODO: force verification of content.
-                    }
-                    else if (result == Closure.RESULT_FETCHKEY) {
-                        // TODO: get the key in the key locator and re-call the interest
-                        //   with the key available in the local storage.
-                    }
-                }
-            }
-            else
-                console.log('Incoming packet is not Interest or ContentObject. Discard now.');
-		}
-	  }
-      
-      this.connect(ndn, elementListener);
-// DEBUG      this.connect(ndn, ndn);
-    }
+    if (this.socket == null || this.connectedHost != ndn.host || this.connectedPort != ndn.port)
+      this.connect(ndn);
     
-	//TODO: check local content store first
-	if (closure != null) {
-		var pitEntry = new PITEntry(interest, closure);
-        // TODO: This needs to be a single thread-safe transaction on a global object.
-		NDN.PITTable.push(pitEntry);
-		closure.pitEntry = pitEntry;
-	}
-
-	// Set interest timer
-	if (closure != null) {
-		pitEntry.timerID = setTimeout(function() {
-			if (LOG > 3) console.log("Interest time out.");
-				
-			// Remove PIT entry from NDN.PITTable.
-            // TODO: Make this a thread-safe operation on the global PITTable.
-			var index = NDN.PITTable.indexOf(pitEntry);
-			//console.log(NDN.PITTable);
-			if (index >= 0) 
-	            NDN.PITTable.splice(index, 1);
-			//console.log(NDN.PITTable);
-			//console.log(pitEntry.interest.name.getName());
-				
-			// Raise closure callback
-			closure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT, new UpcallInfo(ndn, interest, 0, null));
-		}, interest.interestLifetime);  // interestLifetime is in milliseconds.
-		//console.log(closure.timerID);
-	}
-
-	this.send(encodeToBinaryInterest(interest));
+    ndn.expressInterestHelper(interest, closure);
 };