Refactored configuration loading