added thomas answer for tree assignment