This might be a good start, it would seem simple to hook this in to the merging algorithm currently being used (or just replace it).
This might be a good start, it would seem simple to hook this in to the merging algorithm currently being used (or just replace it).