finalizing tree