Refactored CSV and BAM to be less dependent on the key string