update drawGrid function