N-way merge reimplemented and works. All tests passing.