slightly different erase/regen code