refactor config file loading