 bool doorStatus[NUM_DOORS];
 bool lampStatus[NUM_LAMPS];
 char *rfidBuffer[NUM_RFIDS];
-int rfidBufIdx[NUM_RFIDS];
+int rfidBufIdx[NUM_RFIDS]; // -1 means not scanning
 
 void setup() {
   // Serial for communicating with android tablet.

void scanRfid(int rfidId) {
  int c;
  while ((c = serialRead(rfidId + 1)) != -1) {
    rfidBuffer[rfidId][rfidBufIdx[rfidId]++] = c;
    if (rfidBufIdx[rfidId] == 14) {
      rfidBuffer[rfidId][14] = '\0';
      handleRfid(rfidId, rfidBuffer[rfidId]);
      rfidBufIdx[rfidId] = 0;
    }
  }
}


  for (int i = 0; i < NUM_RFIDS; i++) {
    rfidBuffer[i] = new char[15];
    rfidBufIdx[i] = -1; // not scanning
  }

  switch (NUM_RFIDS) {
