Update config file loading.
Clean up some code