added actual code to smooth_grid