attempt to generalize the merging