started modifying code to accept samples instead of rays as such