Refactored get_grid_form a little to be cleaner.