added code for the tree viewer