Refactor Grid to only store Z-coords

Will save 2/3 memory when saving to file; XY-coords can be calculated on
the fly quite simply.