 		 */
 		public function parse(sbgnML:XML):DataSet 
 		{	
-			sbgnml = sbgnML;
-			
+			// Initialize lookup objects
+			glyphToXML = {};
+			arcToXML = {}
 			var lookup:Object = {};
 			
 			var glyphSprites:Array = new Array();

		protected static const ATTRTYPE:String   = "attr.type";
		protected static const DEFAULT:String    = "default";
		
		protected static var sbgnml:XML;
		
		// map for reaching the owners of compartments from the port id.
		protected var portIDtoOwnerGlyph:Object ={};

		/** @inheritDoc */
		public function write(ds:DataSet, output:IDataOutput=null):IDataOutput 
		{
			var sbgnml:XML = new XML(<sbgn/>);
			var map:XML = new XML(MAP);
			
			if (output == null) output = new ByteArray();
			sbgnml.setNamespace(new Namespace(SBGN_NAMESPACE));
			
			//Write back glyphs
			for each (var sprite:CompoundNodeSprite in (ds.nodes as GraphicsDataTable).dataSprites) 
			{	
				map.appendChild((writeGlyph(new XML(), sprite)));
			}
	
			//Write back arcs
			for each (var edgeSprite:EdgeSprite in (ds.edges as GraphicsDataTable).dataSprites) 
			{	
				map.appendChild(arcToXML[edgeSprite.data.id]);
			}
			
			sbgnml.appendChild(map);
	
			output.writeUTFBytes(sbgnml.toXMLString());
			return output;
		}
		
		protected function writeGlyph(glyph:XML, cns:CompoundNodeSprite): XML
		{	
			var tempXML:XML = glyphToXML[cns.data.id];
			var bboxList:XMLList = tempXML.elements("bbox");
			
			for each (var bbox:XML in bboxList) 
			{
				var glyphBbox:Rectangle = cns.data.glyph_bbox;
				
				bbox.@["x"] = cns.x - glyphBbox.width/2;
				bbox.@["y"] = cns.y - glyphBbox.height/2;
			}
			
			glyph = tempXML;
			
			for each (var childSprite:CompoundNodeSprite in cns.getNodes()) 
			{
				writeGlyph(glyph, childSprite);
			}
			
			return tempXML;
		}
		
		/**
