Made num_rays and grid into kwargs.