updated tree functions