Clean up output and prettyprint the parse tree