Update tree and add functions