added rays and simplified some things
Merge commit '84c13eee5b5674e2cb736599f1d2967e7c1070db'