Refactor config setup