Refactor config process.