Add Tree merge, add corresponding tests