Some refactoring for bootstrap