             // watch for page faults
             var modelCursor:IViewCursor = treeData.createCursor();
             if (modelCursor.beforeFirst)
-			{
-				// indicates that an IPE occured on the first item
-				return treeData.length;
-			}
+            {
+                // indicates that an IPE occured on the first item
+                return treeData.length;
+            }
             while (!modelCursor.afterLast)
             {
                 node = modelCursor.current;
                 if (node is XML)
-				{
-					if (firstNode)
-					{	
-						firstNode = false;
-						var parNode:* = node.parent();
-						if (parNode != null)
-						{
-							startTrackUpdates(parNode);
-							childrenMap[parNode] = treeData;
-							parentNode = parNode;
-						}
-					}
-					startTrackUpdates(node);
-				}
-				if (node === null)
-					length += 1;
-				else
-                	length += calculateLength(node, null) + 1;
+                {
+                    if (firstNode)
+                    {   
+                        firstNode = false;
+                        var parNode:* = node.parent();
+                        if (parNode != null)
+                        {
+                            startTrackUpdates(parNode);
+                            childrenMap[parNode] = treeData;
+                            parentNode = parNode;
+                        }
+                    }
+                    startTrackUpdates(node);
+                }
+                if (node === null)
+                    length += 1;
+                else
+                    length += calculateLength(node, null) + 1;
                 modelOffset++;
                 try
                 {

        var prop:String;
        var oldValue:Object;
        var newValue:Object;
		var children:XMLListCollection;
		var location:int;
        var event:CollectionEvent;
		var list:XMLListAdapter;
        
		// trace("currentTarget", currentTarget.toXMLString());
		// trace("target", target.toXMLString());
		// trace("value", value.toXMLString());
		// trace("type", type);

		if (currentTarget === target)
        {
	        switch(type)
	        {
	            case "nodeAdded":
	            {
					for (var q:* in childrenMap)
					{
						if (q === currentTarget)
						{
							list = childrenMap[q].list as XMLListAdapter;
							if (list && !list.busy())
							{
								if (childrenMap[q] === treeData)
								{
									children = treeData as XMLListCollection;
									if (parentNode != null)
									{
										children.mx_internal::dispatchResetEvent = false;
										children.source = parentNode.*;
										children.refresh();
									}
								}
								else
								{
									// this should refresh the collection
									children = getChildren(q) as XMLListCollection; 
								}
								if (children)
								{
									// now we fake an event on behalf of the
									// child collection
									location = value.childIndex();
									event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
									event.kind = CollectionEventKind.ADD;
									event.location = location;
									event.items = [ value ];
									children.dispatchEvent(event);
								}
							}
							break;
						}
					}
	                break;
	            }

				/* needed?
	            case "nodeChanged":
	            {
	                prop = value.localName();
	                oldValue = detail;
	                newValue = value;
	                break;
	            }
				*/

	            case "nodeRemoved":
	            {
					// lookup doesn't work, must scan instead
					for (var p:* in childrenMap)
					{
						if (p === currentTarget)
						{
							children = childrenMap[p];
							list = children.list as XMLListAdapter;
							if (list && !list.busy())
							{
								var xmllist:XMLList = children.source as XMLList;

								if (childrenMap[p] === treeData)
								{
									children = treeData as XMLListCollection;
									if (parentNode)
									{
										children.mx_internal::dispatchResetEvent = false;
										children.source = parentNode.*;
										children.refresh();
									}
								}
								else
								{
									var oldChildren:XMLListCollection = children;
									// this should refresh the collection
									children = getChildren(p) as XMLListCollection;
									if (!children)
									{
										// last item got removed so there's no child collection
    									oldChildren.addEventListener(CollectionEvent.COLLECTION_CHANGE,
    																  nestedCollectionChangeHandler, false, 0, true);

										event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
										event.kind = CollectionEventKind.REMOVE;
										event.location = 0;
										event.items = [ value ];
										oldChildren.dispatchEvent(event);
    									oldChildren.removeEventListener(CollectionEvent.COLLECTION_CHANGE,
    																  nestedCollectionChangeHandler);

									}
								}
								if (children)
								{
									var n:int = xmllist.length();
									for (var i:int = 0; i < n; i++)
									{
										if (xmllist[i] === value)
										{
											event = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
											event.kind = CollectionEventKind.REMOVE;
											event.location = location;
											event.items = [ value ];
											children.dispatchEvent(event);
											break;
										}
									}
								}
							}
							break;
						}
					}
	                break;
	            }

	            default:
				{
	                break;
				}
	        }
        }
    }


        if (event is CollectionEvent)
        {
            var ce:CollectionEvent = CollectionEvent(event);
            if (ce.kind == CollectionEventKind.REFRESH)
            {
                // collection refreshed, update length
                updateLength();
            }
            else if (ce.kind == CollectionEventKind.RESET)
            {
                // initialize the collection again - its source is modified
                if (hierarchicalData)
