Refined RayTest code and interface.