Generalised the size of the grid, and did more cleaning up and commenting