update grids with edges, doesn't work with optimized