Added code from tree test