How relays work