working on new tree code