Improved recursive partial merge.