made lighting code more sensible