Initial version of key-sorted merging.