         return 0;
     }
 
-    /**
-     * Pull the date objects from the values and compare them.
-     */
-    public static function dateCompare(a:Object, b:Object):int
+    public static function dateCompare(fa:Date, fb:Date):int
     {
-        var fa:Date;
-        try
-        {
-            fa = a as Date;
-        }
-        catch(error:Error)
-        {
-        }
-
-        var fb:Date;
-        try
-        {
-            fb = b as Date;
-        }
-        catch(error:Error)
-        {
-        }
-
-        if (fa == null && fb == null)
-            return 0;
-
-        if (fa == null)
-            return 1;
-
-        if (fb == null)
-            return -1;
-
         var na:Number = fa.getTime();
         var nb:Number = fb.getTime();
 

        return 0;
    }

    /**
     * Pull the strings from the objects and call the implementation.
     */
    public static function stringCompare(a:Object, b:Object, caseInsensitive:Boolean):int
    {
        var fa:String;
        try
        {
            fa = String(a);
        }
        catch(error:Error)
        {
        }

        var fb:String;
        try
        {
            fb = String(b);
        }
        catch(error:Error)
        {
        }

        if (fa == null && fb == null)
            return 0;

        if (fa == null)
            return 1;

        if (fb == null)
            return -1;

        // Convert to lowercase if we are case insensitive.
        if (caseInsensitive)
        {

        return result;
    }

    public static function xmlCompare(a:XML, b:XML, numeric:Boolean, caseInsensitive:Boolean):int
    {
        var sa:String;
        try
