refactor config parser