swap to merge instead of reverse_merge where unnecessary