Moved grid-to-ascii and ascii-to-grid functions to separate file