drawGrid function written