refactor config file parsing code