Refactored config parsing code.