Add methods to read and write grids to and from a file.
Refactor to put instance methods on the Grid prototype.