Added getLightState() and re-arranged code a bit.