tree doesn't have to be passed as an array