new function for tree object arrays