moving most of the init so config can be done in-process