diff --git a/asterix-app/src/main/resources/sdk/static/cherry/js/cherry.js b/asterix-app/src/main/resources/sdk/static/cherry/js/cherry.js
index 2f57e26..18f5925 100755
--- a/asterix-app/src/main/resources/sdk/static/cherry/js/cherry.js
+++ b/asterix-app/src/main/resources/sdk/static/cherry/js/cherry.js
@@ -232,10 +232,9 @@
 
 		var build_cherry_mode = "synchronous";
 		
-		// FIXME
-		//if ($('#asbox').is(":checked")) {
-		//    build_cherry_mode = "asynchronous";
-		//}
+		if ($('#asbox').is(":checked")) {
+		    build_cherry_mode = "asynchronous";
+		}
 	
         var f = new FLWOGRExpression()
             .bind(new ForClause("$t", new AExpression().set("dataset TweetMessages")))
@@ -258,7 +257,11 @@
         param_placeholder["payload"] = formData;
         param_placeholder["query_string"] = "use dataverse twitter;\n" + f.val();
         
-        A.query(f.val(), cherryQuerySyncCallback);
+        if (build_cherry_mode == "synchronous") {
+            A.query(f.val(), cherryQuerySyncCallback, build_cherry_mode);
+        } else {
+            A.query(f.val(), cherryQueryAsyncCallback, build_cherry_mode);
+        }
     
 		APIqueryTracker = {
 		    "query" : "use dataverse twitter;\n" + f.val(),
@@ -267,12 +270,11 @@
 		
 		$('#dialog').html(APIqueryTracker["query"]);
 
-        // FIXME
-        //if (!$('#asbox').is(":checked")) {
-		//    $('#show-query-button').attr("disabled", false);
-        //} else {
-        //    $('#show-query-button').attr("disabled", true);
-        //}
+        if (!$('#asbox').is(":checked")) {
+		    $('#show-query-button').attr("disabled", false);
+        } else {
+            $('#show-query-button').attr("disabled", true);
+        }
         
         // FIXME disable click behavior for tabs while running sync query?
     });
@@ -293,6 +295,7 @@
 
 /** Asynchronous Query Management - Handles & Such **/
 
+
 /**
 * Checks through each asynchronous query to see if they are ready yet
 */
@@ -304,6 +307,7 @@
     }
 }
 
+
 /**
 * Returns current time interval to check for asynchronous query readiness
 * @returns  {number}    milliseconds between asychronous query checks
@@ -313,24 +317,6 @@
     return seconds * 1000;
 }
 
-/**
-* Updates UI when an API Query's status is marked ready
-* @param    {Object}    res, a result object from the Asterix API
-* @param    {object}    extra_info, containing the asynchronous handle's id
-*/
-function asynchronousQueryAPIStatusReceived (res, extra_info) {
-
-    var handle_id = extra_info["handle_id"];
-    if (res["status"] == "SUCCESS") {
-    
-        // We don't need to check if this one is ready again, it's not going anywhere...
-        // Unless the life cycle of handles has changed drastically
-        asyncQueryManager[handle_id]["ready"] = true;
-        
-        // Make this handle's result look retrievable
-        $('#handle_' + handle_id).addClass("label-success");
-    }    
-}
 
 /**
 * Retrieves status of an asynchronous query, using an opaque result handle from API
@@ -339,30 +325,34 @@
 */
 function asynchronousQueryGetAPIQueryStatus (handle, handle_id) {
 
-    var a = new AExpression();
-    a.run(
-        "http://localhost:19002/query/status",
+    // FIXME query status call should disable other functions while it 
+    // loads...for simplicity, really...
+    A.query_status( 
         {
             "handle" : JSON.stringify(handle)
         },
-        {
-            "sync" : asynchronousQueryAPIStatusReceived
-        },
-        {
-            "handle_id" : handle_id
-        }         
-     )
+        function (res) {
+            if (res["status"] == "SUCCESS") {
+                // We don't need to check if this one is ready again, it's not going anywhere...
+                // Unless the life cycle of handles has changed drastically
+                asyncQueryManager[handle_id]["ready"] = true;
+            
+                // Indicate success. 
+                $('#handle_' + handle_id).addClass("label-success");
+            }
+        }    
+     );
 }
 
+
 /**
 * On-success callback after async API query
 * @param    {object}    res, a result object containing an opaque result handle to Asterix
-* @param    {object}    extra, a result object containing a query string and query parameters
 */
-function cherryQueryAsyncCallback(res, extra) {
+function cherryQueryAsyncCallback(res) {
     
     // Parse handle, handle id and query from async call result
-    var handle_query = extra["query_string"];
+    var handle_query = param_placeholder["query_string"];
     var handle = res;
     var handle_id = res["handle"].toString().split(',')[0]; 
     
@@ -370,8 +360,7 @@
     asyncQueryManager[handle_id] = {
         "handle" : handle,
         "query" : handle_query,
-        "data" : extra["payload"],
-        //"ready" : true
+        "data" : param_placeholder["payload"],
     };
     
     $('#review-handles-dropdown').append('<a href="#" class="holdmenu"><span class="label" id="handle_' + handle_id + '">Handle ' + handle_id + '</span></a><br/>');
@@ -400,19 +389,10 @@
             $('#dialog').html(APIqueryTracker["query"]);
         
             // Generate new Asterix Core API Query
-            var ah = new AExpression();
-            ah.run(
-                "http://localhost:19002/query/result",
-                { "handle" : JSON.stringify(asyncQueryManager[handle_id]["handle"])},
-                {
-                    "sync"  : cherryQuerySyncCallback,
-                },
-                {
-                    "payload"       : asyncQueryManager[handle_id]["data"],
-                    "query_string"  : asyncQueryManager[handle_id]["query"]
-                }
+            A.query_result(
+                { "handle" : JSON.stringify(asyncQueryManager[handle_id]["handle"]) },
+                cherryQuerySyncCallback
             );
-            
         }
     });
 }
@@ -867,12 +847,13 @@
         // Attach a message showing minimum bounds     
         $('#legend-label').html('Regions with at least ' + breakpoints[0] + ' tweets');
         $('#legend-label').css({
+            "margin-top" : 0,
             "color" : "black"
         });
     }
     
     // Add legend to map
-    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('legend-holder'));
+    map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(document.getElementById('legend-holder'));
     $('#map_canvas_legend').show(); 
 }
 
@@ -895,7 +876,11 @@
     map_tweet_markers = [];
     
     // Remove legend from map
-    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].clear();
+    map.controls[google.maps.ControlPosition.LEFT_BOTTOM].clear();
+    
+    // Reset map center and zoom
+    map.setCenter(new google.maps.LatLng(38.89, 77.03));
+    map.setZoom(4);
 }
 
 /**
diff --git a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
index e4bd564..dd03e9c 100644
--- a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
+++ b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
@@ -20,19 +20,19 @@
 };
 
 
-AsterixDBConnection.prototype.query = function(statements, successFn) {
+AsterixDBConnection.prototype.query = function(statements, successFn, mode) {
  
     if ( typeof statements === 'string') {
         statements = [ statements ];
     }
     
+    var m = mode;
     var query = "use dataverse " + this._properties["dataverse"] + ";\n" + statements.join("\n");
-    var mode = this._properties["mode"];
     
     this._api(
         {
             "query" : query,
-            "mode"  : mode
+            "mode"  : m
         },
         successFn, 
         "http://localhost:19002/query"
@@ -42,6 +42,28 @@
 };
 
 
+AsterixDBConnection.prototype.query_status = function(data, successFn) {
+
+    this._api(
+        data,
+        successFn,
+        "http://localhost:19002/query/status"
+    );
+
+    return this;
+};
+
+
+AsterixDBConnection.prototype.query_result = function(data, successFn) {
+    this._api(
+        data,
+        successFn,
+        "http://localhost:19002/query/result"
+    ); 
+
+    return this;
+};
+
 AsterixDBConnection.prototype._api = function(json, onSuccess, endpoint) {
     var success_fn = onSuccess;
     
@@ -83,55 +105,6 @@
 
 
 AExpression.prototype.run = function(successFn) {
-    var success_fn = successFn;
-
-    $.ajax({
-        type : 'GET',
-        url : "http://localhost:19002/query",
-        data : {"query" : "use dataverse TinySocial;\n" + this.val()},
-        dataType : "json",
-        success : function(data) {     
-            success_fn(data);
-        },
-        error: function(r) {
-            //alert(JSON.stringify(r));
-        }
-    });
-
-    /*$.ajax({
-        "type" : 'GET',
-        "url" : endpoint,
-        "data" : payload,
-        "dataType" : "json",
-        "success" : function(response) {     
-        
-            alert("DEBUG: Run Response: " + JSON.stringify(response));
-        
-            if (response && response["error-code"]) {
-           
-                alert("Error [Code" + response["error-code"][0] + "]: " + response["error-code"][1]);
-            
-            } else if (response && response["results"]) {
-            
-                var fn_callback = myThis._callbacks["sync"];
-                fn_callback(response, myThis._extras);
-            
-            } else if (response["handle"]) {
-            
-                var fn_callback = myThis._callbacks["async"];
-                fn_callback(response, myThis._extras);
-            
-            } else if (response["status"]) {
-                
-                var fn_callback = myThis._callbacks["sync"];
-                fn_callback(response, myThis._extras);
-            }
-        },
-        "error": function (xhr, ajaxOptions, thrownError) {
-            alert("AJAX ERROR " + thrownError);
-        }
-    });*/
-
     return this;
 };
 
