creating a merging method