correct and update the 'tree' functionality