Added logic to turn LEDs on and off