Refactor bootstrapping

Refactor bootstraping