Integrate collapse parse tree so it is not in its own loop