light sensor logic added