main: clean up the code surrounding config file loading