 
   if (Serial.available()) { //DO NOT allow mode reconfiguration via bluetooth. Security hazard.
     char cleanout = ' ';
-
-    //Cleans out any garbage left in the Serial port
-    while (cleanout != '|' && Serial.available()) {
-      cleanout = Serial.read();
-    }
+    char input = ' ';
+
+    delay(10);
+    cleanout = Serial.read();
+    input = Serial.read();
 
     //if the beginning of a command is found (takes care of "|\0" and "||" possible cases)
-    if (cleanout == '|' && Serial.available() && Serial.peek() != '|') {
+    if (cleanout == '|' && input != '|') {
       if (opMode == alarm) { //What if the Serial command was triggered to reconfigure? (CHECK WITH EUGEN THAT POWER AND USB COMBINED WON'T FRY THE BOARD!)
-        char input = Serial.read();
 
         if (input == '2') { //a heartbeat came in, respond
           int heartResult = heartbeat(true);

    int checkReturned = atoi((const char *) &num) * 10;
    num = Serial.read();
    checkReturned += atoi((const char *) &num);
    
    if (Serial.read() != '|') {
      Serial.println ("!Checksum malformed.");
      if (lostComms) {

      }
    }
  }
}

//Base speaker code from http://www.arduino.cc/en/Tutorial/PlayMelody
