   // if(writeCounter < MAX_WRITES) return;
   if(SERIAL_DEBUG) {
     Serial.print("w");
-    Serial.println(index);
+    Serial.print(busIndex);
   }
   // begin with pulse so other side can start listening
-  digitalWrite(TX[index], LOW);
+  digitalWrite(TX[busIndex], LOW);
   delay(2);
-  digitalWrite(TX[index], HIGH);
-  bus[index]->write(value);
-}
-
-void setActiveBus(int index) {
+  digitalWrite(TX[busIndex], HIGH);
+  bus[busIndex]->write(value);
+}
+
+void setActiveBus(int busIndex) {
   if(SERIAL_DEBUG) {
     Serial.print("l");
-    Serial.println(index);
-  }
-  activeBus = index;
+    Serial.println(busIndex);
+  }
+  activeBus = busIndex;
   listenStartTime = millis();
-  bus[index]->listen();
+  bus[activeBus]->listen();
 }
 
 void readActiveBus() {

  //addTimer(50, processEnergy);
}

uint8_t rxRead(int index) {
  return *rxPortRegister[index] & rxBitMask[index];
}

void txWrite(int index, int value) {


void loop() {
  if (isSource) {
    if (!digitalRead(button2pin)) { // ToDo: use bitmask
      if(SERIAL_DEBUG) Serial.println("alert");
      char c = ALERT;
      for (int i=0; i<NUM_CONN; i++) txWrite(i, ALERT);
