Added code for light on/off estimations