   //Serial.println(F("firmata reset"));
   BLE_Firmata.attach(SYSTEM_RESET, systemResetCallback);
 
-  Serial.println("Begin firmata");
+  Serial.println(F("Begin firmata"));
   BLE_Firmata.begin();
-  systemResetCallback();  // reset to default config
-  
-
-}
-
+  systemResetCallback();  // reset to default config 
+}
 /*==============================================================================
  * LOOP()
  *============================================================================*/
+
 void loop() 
 {
+  // Check the BTLE link, how're we doing?
   BLEserial.pollACI();
-  if (BLEserial.getState() != ACI_EVT_CONNECTED) {
-      Serial.print("!");
-      delay(100);
-      return;
-  }
-
+  // Link status check
+  BTLEstatus = BLEserial.getState();
+
+  // Check if something has changed
+  if (BTLEstatus != lastBTLEstatus) {
+    // print it out!
+    if (BTLEstatus == ACI_EVT_DEVICE_STARTED) {
+        Serial.println(F("* Advertising started"));
+    }
+    if (BTLEstatus == ACI_EVT_CONNECTED) {
+        Serial.println(F("* Connected!"));
+        // initialize Firmata cleanly
+         firmataInit();
+    }
+    if (BTLEstatus == ACI_EVT_DISCONNECTED) {
+        Serial.println(F("* Disconnected or advertising timed out"));
+    }
+    // OK set the last status change to this one
+    lastBTLEstatus = BTLEstatus;
+  }
+    
+  // if not connected... bail
+  if (BTLEstatus != ACI_EVT_CONNECTED) {
+    delay(100);
+    return;
+  }
+  
+  // For debugging, see if there's data on the serial console, we would forwad it to BTLE
   if (Serial.available()) {
     BLEserial.write(Serial.read());
-
-  }
+  }
+  
+  // Onto the Firmata main loop
+  
   byte pin, analogPin;
-
-
-// **DEBUG ***
-/*
-  for (uint8_t p=0; p<3; p++) {
-    Serial.print(F("\tport[")); Serial.print(p); Serial.print("] = 0x"); Serial.println(portConfigInputs[p], HEX);
-  }
-*/
   
   /* DIGITALREAD - as fast as possible, check for changes and output them to the
-   * FTDI buffer using Serial.print()  */
+   * BTLE buffer using Serial.print()  */
   checkDigitalInputs();  
 
   /* SERIALREAD - processing incoming messagse as soon as possible, while still

      analogInputsToReport = analogInputsToReport &~ (1 << analogPin);
      Serial.print(F("Stop reporting analog pin #")); Serial.println(analogPin);
    } else {
      analogInputsToReport = analogInputsToReport | (1 << analogPin);
      Serial.print(F("Will report analog pin #")); Serial.println(analogPin);
    }
  }

      }
      pinConfig[pin] = INPUT;
      
      // force sending state immediately
      //delay(10);
      //checkDigitalInputs(true);  
    }
    break;
  case OUTPUT:
