 		}
 		
 		/**
+		 * This is a basic compare function similar to the default compare used by Array.sort().
+		 * This function is faster than ObjectUtil.compare(), but does not do deep object compare.
+		 */
+		private static function defaultCompare(a:*, b:*):int
+		{
+			if (a === b)
+				return 0;
+			if (a == null)
+				return 1;
+			if (b == null)
+				return -1;
+			var typeA:String = typeof(a);
+			var typeB:String = typeof(b);
+			if (typeA != typeB)
+				return ObjectUtil.stringCompare(typeA, typeB);
+			if (typeA == 'boolean')
+				return ObjectUtil.numericCompare(Number(a), Number(b));
+			if (typeA == 'number')
+				return ObjectUtil.numericCompare(a as Number, b as Number);
+			if (typeA == 'string')
+				return ObjectUtil.stringCompare(a as String, b as String);
+			if (a is Date && b is Date)
+				return ObjectUtil.dateCompare(a as Date, b as Date);
+			return 0;
+		}
+		
+		/**
 		 * This is the sorted Array (or Vector), or null if the sort operation has not completed yet.
 		 */
 		public function get result():*
 		{
-			return size >= length ? array : null;
-		}
-		
-		private var compare:Function;
-		private var array:*;
-		private var length:uint;
-		private var size:uint;
-		private var start:uint;
-		private var middle:uint;
-		private var end:uint;
-		private var iLeft:uint;
-		private var iRight:uint;
-		private var iBuffer:uint;
-		private var buffer:*;
-		private var merging:Boolean;
-		private var swapped:Boolean;
-		private var elapsed:int;
-		private var _immediately:Boolean = false;
+			return source ? null : original;
+		}
+		
+		private var original:*; // original array
+		private var source:*; // contains sub-arrays currently being merged
+		private var destination:*; // buffer to store merged sub-arrays
+		private var compare:Function; // compares two array items
+		private var length:uint; // length of original array
+		private var subArraySize:uint; // size of sub-array
+		private var middle:uint; // end of left and start of right sub-array
+		private var end:uint; // end of right sub-array
+		private var iLeft:uint; // left sub-array source index
+		private var iRight:uint; // right sub-array source index
+		private var iMerged:uint; // merged destination index
+		private var elapsed:int; // keeps track of elapsed time inside iterate()
+		private var _immediately:Boolean = false; // set in sortImmediately(), checked in beginSort()
 		
 		/**
 		 * This will begin an asynchronous sorting operation on the specified Array (or Vector).

		
		/*************
		 ** Testing **
		 *************/		
		
		//test(); // Class('weave.utils.AsyncSort').test()
		public static function test():void
		{
			for each (var n:uint in [50,3000,6000,12000,25000,50000])
			{
				var array:Array = [];
				for (var i:int = 0; i < n; i++)
					array.push(uint(Math.random()*100));
				var array2:Array = array.concat();
				
				var start:int = getTimer();
				_debugCompareCount = 0;
				array.sort(_debugCompare);
				trace('Array.sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
				
				_debugCompareCount = 0;
				start = getTimer();
				sortImmediately(array2, _debugCompare);
				//trace('Merge Sort', n, 'numbers;', _immediateSorter.elapsed / 1000, 'seconds;',_debugCompareCount,'comparisons');
				trace('Merge Sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
				
				verifySorted(array2);
			}
		}
		private static function verifySorted(array:Array):void
		{
			for (var i:int = 1; i < array.length; i++)
			{
				if (array[i - 1] > array[i])
				{
					throw new Error("ASSERTION FAIL " + array[i - 1] + ' > ' + array[i]);
				}

			
			while (getTimer() < stopTime)
			{
				if (iLeft < middle) // if there are still more items in the left sub-array
				{
					// copy smallest value to merge destination
					if (iRight < end && compare(source[iRight], source[iLeft]) < 0)
						destination[iMerged++] = source[iRight++];
					else
						destination[iMerged++] = source[iLeft++];
				}
				else if (iRight < end) // if there are still more items in the right sub-array
				{
					destination[iMerged++] = source[iRight++];
				}
				else if (end < length) // if there are still more pairs of sub-arrays to merge
				{
					// begin merging the next pair of sub-arrays
					var start:uint = end;
					middle = Math.min(start + subArraySize, length);
					end = Math.min(middle + subArraySize, length);
					iLeft = start;
					iRight = middle;
					iMerged = start;
				}
				else // done merging all pairs of sub-arrays
				{
					// use the merged destination as the next source
					var merged:* = destination;
					destination = source;
					source = merged;
					
					// start merging sub-arrays of twice the previous size
					end = 0;
					subArraySize *= 2;
					
					// stop if the sub-array includes the entire array
					if (subArraySize >= length)
						break;
				}
			}
			
			elapsed += getTimer() - time;
			
			// if one sub-array includes the entire array, we're done
			if (subArraySize >= length)
			{
				// source array is completely sorted
				if (source != original) // if source isn't the original
				{
					// copy the sorted values to the original
					for (var i:int = length - 1; i >= 0; i--)
						original[i] = source[i];
				}
				
				// clean up so the "get result()" function knows we're done
				source = null;
				destination = null;
				
				return 1; // done
			}
			
			//TODO: improve progress calculation
			return subArraySize / length; // not exactly accurate, but returns a number < 1
		}
		
		private function done():void
