First pass at re-organizing the config loading code.