modified the code for merging patients to allow selection of patients to be merged