Adjusted lighting code to work with the end.