      *  first the layer property, and then the item order, so a stable sort is important (and the 
      *  built in flash sort is not stable).
      */
-	private static function sortOnLayer(a:Vector.<IVisualItem>):void
-	{
-		var len:Number = a.length;
-		var tmp:IVisualItem;
-		if (len<= 1)
-			return;
-		for (var i:int = 1;i<len;i++)
-		{
-			for (var j:int = i;j > 0;j--)
-			{
-				if ( a[j].layer < a[j-1].layer )
-				{
-					tmp = a[j];
-					a[j] = a[j-1];
-					a[j-1] = tmp;
-				}
-				else
-					break;
-			}
-		}
-	}
+    private static function sortOnLayer(a:Vector.<IVisualItem>):void
+    {
+        var len:Number = a.length;
+        var tmp:IVisualItem;
+        if (len<= 1)
+            return;
+        for (var i:int = 1;i<len;i++)
+        {
+            for (var j:int = i;j > 0;j--)
+            {
+                if ( a[j].layer < a[j-1].layer )
+                {
+                    tmp = a[j];
+                    a[j] = a[j-1];
+                    a[j-1] = tmp;
+                }
+                else
+                    break;
+            }
+        }
+    }
 
     /**
      *  @private
      */
     private function assignDisplayObjectTo(item:Object,mergeData:GroupDisplayObjectMergeData):void
     {
-    	if (mergeData.lastDisplayObject == this)
-    		mergeData.insertIndex = 0;
-    	else
-    		mergeData.insertIndex = super.getChildIndex(mergeData.lastDisplayObject) + 1;
-    		
+        if (mergeData.lastDisplayObject == this)
+            mergeData.insertIndex = 0;
+        else
+            mergeData.insertIndex = super.getChildIndex(mergeData.lastDisplayObject) + 1;
+            
         if (item is DisplayObject)
         {
-        	super.setChildIndex(item as DisplayObject, mergeData.insertIndex);
-        	
+            super.setChildIndex(item as DisplayObject, mergeData.insertIndex);
+            
             mergeData.lastDisplayObject = item as DisplayObject;
             // Null this out so that we are forced to create one for the next item
             mergeData.currentAssignableDO = null; 

    /**
     *  Adds an item to this Group. The item is added after all other
     *  items and on top of all other items.  (To add an item to a specific 
     *  index position, use the addChildAt() method.)
     * 
     * <p>If you add an item object that already has a different
     * container as a parent, the object is removed from the child 
     * list of the other container.</p>  
     *
     *  @param item The item to add as a child of this Group instance
     *
     *  @return The item that was added to the Group.
     * 
     *  @event itemAdded Dispatched when the item is added to the child list
     * 
     *  @throws ArgumentError if the child is the same as the parent.
     */   
    public function addItem(item:Object):Object
    {

        {  
            var item:Object = getItemAt(i);
            
            if (layeringMode != ITEM_ORDERED_LAYERING)
            {
                var layer:Number = 0;
                if (item is IVisualItem)
                    layer = (item as IVisualItem).layer;
                if (layer != 0)
                {               
                    if (layer > 0)
                    {
                        if (topLayerItems == null) topLayerItems = new Vector.<IVisualItem>();
                        topLayerItems.push(item);
                        continue;                   
                    }
                    else
                    {
                        if (bottomLayerItems == null) bottomLayerItems = new Vector.<IVisualItem>();
                        bottomLayerItems.push(item);
                        continue;                   
                    }
                }
            }
            assignDisplayObjectTo(item,mergeData);
        }
        if (topLayerItems != null)
        {
            keepLayeringEnabled = true;
            //topLayerItems.sortOn("layer",Array.NUMERIC);
            sortOnLayer(topLayerItems);
            len = topLayerItems.length;
            for (i=0;i<len;i++)
            {
                assignDisplayObjectTo(topLayerItems[i],mergeData);
            }
        }
        
        if (bottomLayerItems != null)
        {
            keepLayeringEnabled = true;
            mergeData.currentAssignableDO  = null;
            mergeData.lastDisplayObject = this;
            mergeData.insertIndex = 0;

            //bottomLayerItems.sortOn("layer",Array.NUMERIC);
            sortOnLayer(bottomLayerItems);
            len = bottomLayerItems.length;

            for (i=0;i<len;i++)
            {
                assignDisplayObjectTo(bottomLayerItems[i],mergeData);
            }
        }
        
        if (keepLayeringEnabled == false)
            layeringMode = ITEM_ORDERED_LAYERING;        
    }
    
    /**
