API update - separates internal query handlers
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 0e35865..38f0f77 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
@@ -255,7 +255,7 @@
         param_placeholder["payload"] = formData;
         param_placeholder["query_string"] = "use dataverse twitter;\n" + f.val();
         
-        A.run(f.val(), cherryQuerySyncCallback);
+        A.query(f.val(), cherryQuerySyncCallback);
     
 		APIqueryTracker = {
 		    "query" : "use dataverse twitter;\n" + f.val(),
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 bb7bc5f..e4bd564 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,10 +20,8 @@
 };
 
 
-AsterixDBConnection.prototype.run = function(statements, successFn) {
-
-    var success_fn = successFn;
-   
+AsterixDBConnection.prototype.query = function(statements, successFn) {
+ 
     if ( typeof statements === 'string') {
         statements = [ statements ];
     }
@@ -31,26 +29,37 @@
     var query = "use dataverse " + this._properties["dataverse"] + ";\n" + statements.join("\n");
     var mode = this._properties["mode"];
     
-    $.ajax({
-        type : 'GET',
-        url : "http://localhost:19002/query",
-        data : {
+    this._api(
+        {
             "query" : query,
-            "mode" : mode
+            "mode"  : mode
         },
-        dataType : "json",
-        success : function(data) {     
-            success_fn(data);
-        },
-        error: function(r) {
-            //alert("AsterixSDK ERROR\n" + JSON.stringify(r));
-        }
-    });
+        successFn, 
+        "http://localhost:19002/query"
+    );
 
     return this;
 };
 
 
+AsterixDBConnection.prototype._api = function(json, onSuccess, endpoint) {
+    var success_fn = onSuccess;
+    
+    $.ajax({
+        type: 'GET',
+        url: endpoint,
+        data : json,
+        dataType: "json",
+        success: function(data) {
+            success_fn(data);
+        }
+        // TODO error:
+    });
+    
+    return this;
+};
+
+
 // Asterix Expressions
 function AExpression () {
     this._properties = {};