Feature parity with the C++ version

Implemented the modified Merge operation, which I forgot to do before.