   //Sensor has been triggered or serial has been triggered
   //Communications dictionary: '1' = alarm, '2' = heartbeat, '5' = reconfiguration
   //Reconfiguration protocol: "5 *mode*" ('5' signals that the next command is a reconfiguration, then a space, then the mode (0=sensor, 1=alarm, 2=query))
-  //Todo: in laptop relay, program it to only forward the communications dictionary commands, need a way to signal groups of communications
+  //Message packet structure: first character is ! (user text) or | (data). Packets are terminated by a \n (user text) or | (data)
+  //DONE Todo: in laptop relay, program it to only forward the communications dictionary commands
   //DONE Todo: include fluctuation tolerance (e.g. 10 activations required before alarm)
   //DONE Todo: heartbeat communications
-  //Todo: communications on the serial interfaces may have varying length. Account for it
+  //DONE Todo: communications on the serial interfaces may have varying length. Account for it
   //DONE Todo: slow down bluetooth send rate. It's too fast and will leave an alarm on forever.
-  //Todo: sort out serial communications into "protocols" and message grouping, so that serial data can be processed properly by the computer (e.g. start/stop characters, escape characters, etc.)
-  //rough thought: just surround each message with '|' to separate messages, and keep a bool indicating if the program is still inside a message or not. Allows to compare commands against a "mask" to avoid commands
-  //interferring with each other, blocking malformed commands, and such.
-  //Todo: signal binary data
+  //DONE Todo: set up message packet stucture
 
   if (opMode == sensor) {
     waterReadings();

      }
    }
  }
  alarmSounding = false;
}

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


  if (Serial.available()) { //DO NOT allow mode reconfiguration via bluetooth. Security hazard.
    char cleanout = ' ';
    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 == '|' && 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!)

        if (input == '2') { //a heartbeat came in, respond
          int heartResult = heartbeat(true);
