refactoring to use config