updated the grid generation