Refactor the centering of grid on screen.