added function for merging read groups