refactored lighting_function() by using some local variables