Removing hardcoding in drawing the grid