more refactoring for the parser