Refactor config parsing.