Merging

Many improvements to the merging backend