Introduce locate_merge_partitions helper function, change around some names.