new tree code