refactor loading config files