Refactor config