re-implement bam to bed to more sam/bam friend interface using htslib; add header to all code