corrected the starting point
updated the grid drawing procedure