Integrate new header merging code into bam_sort main function