added if statement to check if light is avaiable