refactored config read