refactoring of config loading