reworked the regrid function