refactored the parser to be more performant