Made grid_builder more functional!!

Removed mutable state from build_from_grid().