refactored config handling