Refactored bootstrap code.