Added tree merging