Refactor config creation