added ip stuff; switched on and off for the relays