     
     Serial.begin(9600);             // Used for logging
 #ifdef sparkdebug
-    while(!Serial.available()) SPARK_WLAN_Loop();
+    while(!Serial.available()) Particle.process();
     Serial.print("Beginning bridge process with connectable = ");
     Serial.println(connectable);
 #endif

    if (client.connected()) {
        client.stop();
    }
    Spark.sleep(SLEEP_MODE_DEEP, 1);    // Reboot the Spark Core after one second
}

void copyHubsToRAM(void) {

        while(idx < framelen) {
            do {
                c = client.read();
                if (c == -1) Particle.process();
            } while (c == -1);
            
            //if (idx < 3)
