merge node tree functions