         client.fastrprintln(F("Content-Type: application/json"));
         client.fastrprintln(F("Connection: close"));
         client.fastrprintln(F("Server: Adafruit CC3000"));
+        client.fastrprint(F("Content-Length: ")); client.fastrprintln(resLength);
         // Send an empty line to signal start of body.
         client.fastrprintln(F(""));
         // Now send the response data.
-        if (callback != NULL) {
-          sprintf(response, "%s({\"type\":\"%s\",\"value\":%s})", callback, type, value);
-        } else {
-          sprintf(response, "{\"type\":%s,\"value\":%s}", type, value);
-        }
         client.fastrprintln(response);
-        #ifdef debug
-          Serial.print(F("Response: "));
-          Serial.println(response);
+        
+        #ifdef DEBUG
+          PRINT_DEBUG("Response: ", response);
         #endif
-        /*
-        if (callback != NULL) {
-          client.fastrprint(callback);
-          client.fastrprint(F("("));
-        }
-        client.fastrprint(F("{\"type\": \""));
-        client.fastrprint(type);
-        client.fastrprint(F("\", \"value\": "));
-        client.fastrprint(value);
-        client.fastrprint(F("}"));
-        if (callback != NULL) {
-          client.fastrprint(F(");"));
-        }
-        client.fastrprintln(F(""));
-        */
       }
       else {
         // Unsupported action, respond with an HTTP 405 method not allowed error.

    
    // Handle the request if it was parsed.
    if (parsed) {
      #ifdef debug
        Serial.println(F("Processing request"));
        Serial.print(F("Action: ")); Serial.println(action);
        Serial.print(F("Path: ")); Serial.println(path);


// Variables to hold current state.
int currentScheme = 0;
Pattern currentPattern = GRADIENT;
Animation currentAnimation = RAINBOW_CYCLE;
int currentWidth = 0;
int currentSpeed = 20;
bool isAnimation = true;

uint8_t buffer[BUFFER_SIZE+1];
int bufindex = 0;
