fixed code to work with multiple light source