added TODO
moved ray<->grid function definitions together for clarity
added comments explaining the grid->ray function