Refactored handling of config