Refactored configuration handling