reorganized

split reflection/refraction into two functions. Fixed recursion.