working on tree operations in output and intermediate