About to re-write for sorted SAM input.