refactor the parser