[GRID] Optimize and improve calculation of cell coordinates.