Fixed bugs in reflection code.
Set correct ray type on shadow attenuation rays.
Implemented refraction.