factored out rebuild scripts