refactor repack setup a bit