Refactored real bootstrapping implementations to allow the same logic to be used for test bootstrapping.