1) Fixed debug() call.
2) Added checks for light objects that do not have color (dimmable
lights)
3) Improved comments all around.