small edits in merging alg