improved logic for swwitching on and off the loads