(WIP) Refactor bootstrapping

(branched off other pr)