some cleaning up, and swapped the axes so the grid is vertical