finished parser rewrite