Refactored config loader