Improve efficiency of contact merge