diff --git a/js/encoding/BinaryXMLDecoder.js b/js/encoding/BinaryXMLDecoder.js
index 0c88e0f..53343f4 100644
--- a/js/encoding/BinaryXMLDecoder.js
+++ b/js/encoding/BinaryXMLDecoder.js
@@ -537,12 +537,11 @@
 };
 
 
-//byte[]
+//Uint8Array
 BinaryXMLDecoder.prototype.decodeBlob = function(
 		//int 
 		blobLength) {
 	
-	
 	if(null == blobLength){
 		//TypeAndVal
 		tv = this.decodeTypeAndVal();
@@ -560,12 +559,10 @@
 	}
 	
 	//
-	//byte [] 
-
-	var bytes = this.istream.slice(this.offset, this.offset+ blobLength);
+	//Uint8Array
+	var bytes = this.istream.subarray(this.offset, this.offset+ blobLength);
 	this.offset += blobLength;
 	
-	//int 
 	return bytes;
 };
 
@@ -679,9 +676,6 @@
 TypeAndVal.prototype.val = function(){
 	return this.v;
 };
-//TODO
-
-
 
 
 
@@ -713,13 +707,14 @@
 		return strElementText;
 };
 
+
 /* 
  * Set the offset into the input, used for the next read.
  */
 BinaryXMLDecoder.prototype.seek = function(
         //int
         offset) {
-    this.offset = offset;        
+    this.offset = offset;
 }
 
 /*
@@ -734,4 +729,3 @@
 ContentDecodingException.prototype = new Error();
 ContentDecodingException.prototype.name = "ContentDecodingException";
 
-
diff --git a/js/encoding/BinaryXMLEncoder.js b/js/encoding/BinaryXMLEncoder.js
index c8eec3b..2a67e05 100644
--- a/js/encoding/BinaryXMLEncoder.js
+++ b/js/encoding/BinaryXMLEncoder.js
@@ -41,37 +41,37 @@
 
 
 var BinaryXMLEncoder = function BinaryXMLEncoder(){
-
-	this.ostream = new Array(10000);
-	
-	
+	this.ostream = new Uint8Array(10000);
 	this.offset =0;
-	
 	this.CODEC_NAME = "Binary";
-	
 };
 
-BinaryXMLEncoder.prototype.writeUString = function(/*String*/ utf8Content){
+
+BinaryXMLEncoder.prototype.writeUString = function(/*String*/ utf8Content) {
 	this.encodeUString(this.ostream, utf8Content, XML_UDATA);
 };
 
-BinaryXMLEncoder.prototype.writeBlob = function(/*byte []*/ binaryContent
+
+BinaryXMLEncoder.prototype.writeBlob = function(
+		/*Uint8Array*/ binaryContent
 		//, /*int*/ offset, /*int*/ length
-		)  {
+		) {
 	
 	if(LOG >3) console.log(binaryContent);
 	
 	this.encodeBlob(this.ostream, binaryContent, this.offset, binaryContent.length);
 };
 
-BinaryXMLEncoder.prototype.writeStartElement = function(/*String*/ tag, /*TreeMap<String,String>*/ attributes){
 
-	/*Long*/ dictionaryVal = tag;//stringToTag(tag);
+BinaryXMLEncoder.prototype.writeStartElement = function(
+	/*String*/ tag, 
+	/*TreeMap<String,String>*/ attributes
+	) {
+
+	/*Long*/ dictionaryVal = tag; //stringToTag(tag);
 	
 	if (null == dictionaryVal) {
-
 		this.encodeUString(this.ostream, tag, XML_TAG);
-		
 	} else {
 		this.encodeTypeAndVal(XML_DTAG, dictionaryVal, this.ostream);
 	}
@@ -82,14 +82,13 @@
 };
 
 
-BinaryXMLEncoder.prototype.writeEndElement = function(){
-
+BinaryXMLEncoder.prototype.writeEndElement = function() {
 	this.ostream[this.offset] = XML_CLOSE;
-	this.offset+= 1;
+	this.offset += 1;
 }
 
+
 BinaryXMLEncoder.prototype.writeAttributes = function(/*TreeMap<String,String>*/ attributes) {
-	
 	if (null == attributes) {
 		return;
 	}
@@ -114,10 +113,9 @@
 		this.encodeUString(this.ostream, strValue);
 		
 	}
-
-	
 }
 
+
 //returns a string
 stringToTag = function(/*long*/ tagVal) {
 	if ((tagVal >= 0) && (tagVal < CCNProtocolDTagsStrings.length)) {
@@ -149,45 +147,35 @@
 		//byte[] 
 		Content,
 		//TreeMap<String, String> 
-		attributes) {
-	
+		attributes
+		) {
 	this.writeStartElement(tag, attributes);
 	// Will omit if 0-length
 	
 	if(typeof Content === 'number') {
-		if(LOG>4) console.log('GOING TO WRITE THE NUMBER .charCodeAt(0) ' +Content.toString().charCodeAt(0) );
-		if(LOG>4) console.log('GOING TO WRITE THE NUMBER ' +Content.toString() );
-		if(LOG>4) console.log('type of number is ' +typeof Content.toString() );
-		
-
+		if(LOG>4) console.log('GOING TO WRITE THE NUMBER .charCodeAt(0) ' + Content.toString().charCodeAt(0) );
+		if(LOG>4) console.log('GOING TO WRITE THE NUMBER ' + Content.toString() );
+		if(LOG>4) console.log('type of number is ' + typeof Content.toString() );
 		
 		this.writeUString(Content.toString());
 		//whatever
-		
 	}
-	
 	else if(typeof Content === 'string'){
-		if(LOG>4) console.log('GOING TO WRITE THE STRING  ' +Content );
-		if(LOG>4) console.log('type of STRING is ' +typeof Content );
+		if(LOG>4) console.log('GOING TO WRITE THE STRING  ' + Content );
+		if(LOG>4) console.log('type of STRING is ' + typeof Content );
 		
 		this.writeUString(Content);
 	}
-	
 	else{
-	//else if(typeof Content === 'string'){
-		 //console.log('went here');
-		//this.writeBlob(Content);
-	//}
-	if(LOG>4) console.log('GOING TO WRITE A BLOB  ' +Content );
-	//else if(typeof Content === 'object'){
+		if(LOG>4) console.log('GOING TO WRITE A BLOB  ' + Content );
+
 		this.writeBlob(Content);
-	//}
 	}
 	
 	this.writeEndElement();
 }
 
-//TODO
+
 
 var TypeAndVal = function TypeAndVal(_type,_val) {
 	this.type = _type;
@@ -195,17 +183,19 @@
 	
 };
 
+
 BinaryXMLEncoder.prototype.encodeTypeAndVal = function(
 		//int
 		type, 
 		//long 
 		val, 
-		//byte [] 
-		buf) {
+		//ArrayBufferView 
+		ostream
+		) {
 	
-	if(LOG>4)console.log('Encoding type '+ type+ ' and value '+ val);
+	if(LOG>4) console.log('Encoding type '+ type+ ' and value '+ val);
 	
-	if(LOG>4) console.log('OFFSET IS ' + this.offset );
+	if(LOG>4) console.log('OFFSET IS ' + this.offset);
 	
 	if ((type > XML_UDATA) || (type < 0) || (val < 0)) {
 		throw new Error("Tag and value must be positive, and tag valid.");
@@ -214,14 +204,14 @@
 	// Encode backwards. Calculate how many bytes we need:
 	var numEncodingBytes = this.numEncodingBytes(val);
 	
-	if ((this.offset + numEncodingBytes) > buf.length) {
-		throw new Error("Buffer space of " + (buf.length-this.offset) + 
+	if ((this.offset + numEncodingBytes) > ostream.length) {
+		throw new Error("Buffer space of " + (ostream.length - this.offset) + 
 											" bytes insufficient to hold " + 
 											numEncodingBytes + " of encoded type and value.");
 	}
 
 	// Bottom 4 bits of val go in last byte with tag.
-	buf[this.offset + numEncodingBytes - 1] = 
+	ostream[this.offset + numEncodingBytes - 1] = 
 		//(byte)
 			(BYTE_MASK &
 					(((XML_TT_MASK & type) | 
@@ -233,9 +223,8 @@
 	// is "more" flag.
 	var i = this.offset + numEncodingBytes - 2;
 	while ((0 != val) && (i >= this.offset)) {
-		buf[i] = //(byte)
-				(BYTE_MASK &
-						    (val & XML_REG_VAL_MASK)); // leave top bit unset
+		ostream[i] = //(byte)
+				(BYTE_MASK & (val & XML_REG_VAL_MASK)); // leave top bit unset
 		val = val >>> XML_REG_VAL_BITS;
 		--i;
 	}
@@ -248,6 +237,7 @@
 	return numEncodingBytes;
 };
 
+
 BinaryXMLEncoder.prototype.encodeUString = function(
 		//OutputStream 
 		ostream, 
@@ -260,23 +250,15 @@
 		return;
 	}
 	
-	
-	//byte [] data utils
-	/*custom*/
-	//byte[]
-	
 	if(LOG>3) console.log("The string to write is ");
-	
 	if(LOG>3) console.log(ustring);
 
 	//COPY THE STRING TO AVOID PROBLEMS
 	strBytes = new Array(ustring.length);
-	
-	var i = 0;	
 
-	for( ; i<ustring.length; i++) //in InStr.ToCharArray())
+	for (i = 0; i < ustring.length; i++) //in InStr.ToCharArray())
 	{
-		if(LOG>3)console.log("ustring[" + i + '] = ' + ustring[i]);
+		if(LOG>3) console.log('ustring[' + i + '] = ' + ustring[i]);
 		strBytes[i] = ustring.charCodeAt(i);
 	}
 	
@@ -292,9 +274,7 @@
 	if(LOG>3) console.log(strBytes);
 	
 	this.writeString(strBytes,this.offset);
-	
 	this.offset+= strBytes.length;
-
 };
 
 
@@ -302,7 +282,7 @@
 BinaryXMLEncoder.prototype.encodeBlob = function(
 		//OutputStream 
 		ostream, 
-		//byte [] 
+		//Uint8Array 
 		blob, 
 		//int 
 		offset, 
@@ -315,21 +295,17 @@
 	
 	if(LOG>4) console.log('LENGTH OF XML_BLOB IS '+length);
 	
+	/*blobCopy = new Array(blob.Length);
 	
-	blobCopy = new Array(blob.Length);
-	var i = 0;
-	for( ;i<blob.length;i++) //in InStr.ToCharArray())
+	for (i = 0; i < blob.length; i++) //in InStr.ToCharArray())
 	{
 		blobCopy[i] = blob[i];
-	}
+	}*/
 
-	this.encodeTypeAndVal(XML_BLOB, length, ostream,offset);
-	
-	if (null != blob) {
+	this.encodeTypeAndVal(XML_BLOB, length, ostream, offset);
 
-		this.writeBlobArray(blobCopy,this.offset);
-		this.offset += length;
-	}
+	this.writeBlobArray(blob, this.offset);
+	this.offset += length;
 };
 
 var ENCODING_LIMIT_1_BYTE = ((1 << (XML_TT_VAL_BITS)) - 1);
@@ -376,13 +352,10 @@
 	
 	if(LOG>4)console.log('ENCODING DATE with BINARY VALUE');
 	if(LOG>4)console.log(binarydate);
-	
 	if(LOG>4)console.log('ENCODING DATE with BINARY VALUE(HEX)');
 	if(LOG>4)console.log(DataUtils.toHex(binarydate));
 	
-
 	this.writeElement(tag, binarydate);
-
 };
 
 BinaryXMLEncoder.prototype.writeString = function(
@@ -396,19 +369,16 @@
     	if(LOG>4) console.log('GOING TO WRITE A STRING');
     	if(LOG>4) console.log(input);
         
-		for (var i = 0; i < input.length; i++) {
+		for (i = 0; i < input.length; i++) {
 			if(LOG>4) console.log('input.charCodeAt(i)=' + input.charCodeAt(i));
 		    this.ostream[this.offset+i] = (input.charCodeAt(i));
 		}
 	}
-    
     else{
-    	
-    	if(LOG>4) console.log('GOING TO WRITE A STRING IN BINARY FORM');
-    	if(LOG>4) console.log(input);
-    	
-    	this.writeBlobArray(input);
-    	
+		if(LOG>4) console.log('GOING TO WRITE A STRING IN BINARY FORM');
+		if(LOG>4) console.log(input);
+		
+		this.writeBlobArray(input);
     }
     /*
 	else if(typeof input === 'object'){
@@ -417,25 +387,23 @@
 	*/
 };
 
+
 BinaryXMLEncoder.prototype.writeBlobArray = function(
-		//String 
-		Blob,
-		//CCNTime 
+		//Uint8Array 
+		blob,
+		//int 
 		offset) {
 	
 	if(LOG>4) console.log('GOING TO WRITE A BLOB');
     
-	for (var i = 0; i < Blob.length; i++) {
+	/*for (var i = 0; i < Blob.length; i++) {
 	    this.ostream[this.offset+i] = Blob[i];
-	}
-	
+	}*/
+	this.ostream.set(blob, this.offset);
 };
 
 
-
 BinaryXMLEncoder.prototype.getReducedOstream = function() {
-	
-	return this.ostream.slice(0,this.offset);
-	
+	return this.ostream.subarray(0, this.offset);
 };
 
