refactored bootstrap code