Start breaking out the bootstrap code into a unified function

Ping @gtmanfred.