rewrite of the grid