 #define NUM_CONN 3
 
 SoftwareSerial* bus[NUM_CONN];
-
 int RX[NUM_CONN] = {A1, A3, A5};
 int TX[NUM_CONN] = {A0, A2, A4};
+volatile uint8_t *rxPortRegister[NUM_CONN];
+uint8_t rxBitMask[NUM_CONN];
+int activeBus = -1;
+unsigned long listenStartTime = 0;
+#define listenTimeout 20
+
 int coil[NUM_CONN] = {6, 5, 10}; // magnets
 int distanceToSource[NUM_CONN] = {99, 99, 99};
 int shortestDistanceToSource;


void dropConnector() {
  // send out message that we're going to drop a connector
  char c = DROPPING_CONNECTOR;
  for (int i=0; i<NUM_CONN; i++) bus[i]->write(c);

  // pick random connected connector to drop
  // count number of ports with a low distance to source

    if (!digitalRead(button2pin)) {
      if(SERIAL_DEBUG) Serial.println("alert");
      char c = ALERT;
      for (int i=0; i<NUM_CONN; i++) txWrite(i, ALERT);
    }
  }

  // check all lines for incoming data
  if (activeBus==-1) {
    for (int i=0; i<NUM_CONN; i++) {
      if (!rxRead(i)) {
        setActiveBus(i);
      }
    }
  } else {
    readActiveBus();
  }

  // update timed processes
