completely refactored the parser