Refactor the parsing code.