simple performance improvements when collapsing parse trees