Code cleanup. But maybe slower speed for reading BAM? Haven't tested
speed yet.