   //addTimer(50, processEnergy);
 }
 
-uint8_t rxRead(int index) {
-  return *rxPortRegister[index] & rxBitMask[index];
+uint8_t rxRead(int busIndex) {
+  return *rxPortRegister[busIndex] & rxBitMask[busIndex];
 }
 
 void txWrite(int index, int value) {

  // seed random generator
  randomSeed(analogRead(7));

  // start sending energy if we're a source
  isSource = digitalRead(button1pin) == LOW;
  if (isSource) {
    addTimer(100, sendEnergy);
    switchLampOn(); // for debugging
  } else {
    switchLampOff();
    processEnergy();
  }

  if(SERIAL_DEBUG) {

  // if(writeCounter < MAX_WRITES) return;
  if(SERIAL_DEBUG) {
    Serial.print("w");
    Serial.print(busIndex);
  }
  // begin with pulse so other side can start listening
  digitalWrite(TX[busIndex], LOW);
  delay(2);
  digitalWrite(TX[busIndex], HIGH);
  bus[busIndex]->write(value);
}

void setActiveBus(int busIndex) {
  if(SERIAL_DEBUG) {
    Serial.print("l");
    Serial.println(busIndex);
  }
  activeBus = busIndex;
  listenStartTime = millis();
  bus[activeBus]->listen();
}

void readActiveBus() {
