add some tree functions