Renamed to tree to be more general