Added checks for bams as well as sams, and conversions to sams when necessary.