refactored print_grid so that it uses @grid instead of an argument