More work on ray casting