Instead of using a "var" here and initializing it to Base.N, use the following approach instead...

````
            val readBase = if (mdTag.isMatch(referencePos)) {
              baseFromSequence(readPos)
            } else {
              mdTag.mismatchedBase(referencePos) match {
                case Some(baseFound) => Base.valueOf(baseFound.toString)
                case None => throw new IllegalArgumentException("Cigar match has no MD (mis)match @" + referencePos + " " + record.getCigar + " " + record.getMismatchingPositions)
              }
            }
````

This allows the base to be a 'val' and make the process of fetching the value clearer.