Rewrite the tree code once the new libmythui is ready

