Improved the tree controller