Refactored and simplified configuration file parsing logic