Extract some code out of setUpPackage