added updateGrid()