new tree functions implemented