refactored config factory