Refactored bootstrap code