working on the tree building