diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
index b9eb07879c75039fb347672c797661a145ad3b9a..62cd27d6bc12f12283a43e065441306c6eecc178 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
@@ -2,6 +2,7 @@ package nl.lumc.sasc.biopet.core.config
 
 import java.io.File
 import org.broadinstitute.gatk.queue.util.Logging
+import scala.language.implicitConversions
 
 trait Configurable extends Logging {
   val root: Configurable
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkPipeline.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkPipeline.scala
index 623dc8c9a783bf33360d9a4654c16f056e9f0ab7..9af84cbbba2212472450b94aefdbe49bc457fd43 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkPipeline.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkPipeline.scala
@@ -3,7 +3,7 @@ package nl.lumc.sasc.biopet.pipelines.gatk
 import nl.lumc.sasc.biopet.core.MultiSampleQScript
 import nl.lumc.sasc.biopet.core.PipelineCommand
 import nl.lumc.sasc.biopet.core.config.Configurable
-import htsjdk.samtools.SAMFileReader
+import htsjdk.samtools.SamReaderFactory
 import scala.collection.JavaConversions._
 import java.io.File
 import nl.lumc.sasc.biopet.extensions.gatk.{ CombineVariants, CombineGVCFs }
@@ -185,7 +185,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
         libraryOutput.mappedBamFile = mapping.outputFiles("finalBamFile")
       } else {
         var readGroupOke = true
-        val inputSam = new SAMFileReader(bamFile)
+        val inputSam = SamReaderFactory.makeDefault.open(bamFile)
         val header = inputSam.getFileHeader.getReadGroups
         for (readGroup <- inputSam.getFileHeader.getReadGroups) {
           if (readGroup.getSample != sampleID) logger.warn("Sample ID readgroup in bam file is not the same")
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVariantcalling.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVariantcalling.scala
index c39a2fc85531cac296f4f77cb39ecb0495d57f55..465a946ee48d761bb955363fe2483a0f5d26ac15 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVariantcalling.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/pipelines/gatk/GatkVariantcalling.scala
@@ -10,6 +10,7 @@ import org.broadinstitute.gatk.queue.QScript
 import org.broadinstitute.gatk.queue.extensions.gatk.TaggedFile
 import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
 import scala.collection.SortedMap
+import scala.language.reflectiveCalls
 
 class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScript {
   def this() = this(null)
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BedToInterval.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BedToInterval.scala
index 436a4ff083eea141b3a45dda18d024022a0960e0..ddac312a90a5aac1cc560b1bd066a4b7af12ed82 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BedToInterval.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BedToInterval.scala
@@ -1,7 +1,6 @@
 package nl.lumc.sasc.biopet.tools
 
-import htsjdk.samtools.SAMFileReader
-import htsjdk.samtools.SAMSequenceRecord
+import htsjdk.samtools.{ SAMSequenceRecord, SamReaderFactory }
 import java.io.File
 import nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
 import nl.lumc.sasc.biopet.core.ToolCommand
@@ -68,7 +67,7 @@ object BedToInterval extends ToolCommand {
 
     val writer = new PrintWriter(commandArgs.outputFile)
 
-    val inputSam = new SAMFileReader(commandArgs.bamFile)
+    val inputSam = SamReaderFactory.makeDefault.open(commandArgs.bamFile)
     val refs = for (SQ <- inputSam.getFileHeader.getSequenceDictionary.getSequences.toArray) yield {
       val record = SQ.asInstanceOf[SAMSequenceRecord]
       writer.write("@SQ\tSN:" + record.getSequenceName + "\tLN:" + record.getSequenceLength + "\n")
@@ -80,10 +79,10 @@ object BedToInterval extends ToolCommand {
     val bedFile = Source.fromFile(commandArgs.inputFile)
     for (
       line <- bedFile.getLines;
-      val split = line.split("\t") if split.size >= 3;
-      val chr = split(0);
-      val start = split(1);
-      val stop = split(2) if start forall Character.isDigit if stop forall Character.isDigit
+      split = line.split("\t") if split.size >= 3;
+      chr = split(0);
+      start = split(1);
+      stop = split(2) if start forall Character.isDigit if stop forall Character.isDigit
     ) {
       if (!refsMap.contains(chr)) throw new IllegalStateException("Chr '" + chr + "' in bed file not found in bam file")
       writer.write(chr + "\t" + start + "\t" + stop + "\t")
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstat.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstat.scala
index 8465f45637bd2f8aec6976ec814d49d00636d338..31da6e44803307497f731c0e4155d18e2d0adf09 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstat.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BiopetFlagstat.scala
@@ -1,7 +1,6 @@
 package nl.lumc.sasc.biopet.tools
 
-import htsjdk.samtools.SAMFileReader
-import htsjdk.samtools.SAMRecord
+import htsjdk.samtools.{ SAMRecord, SamReaderFactory }
 import java.io.File
 import nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
 import nl.lumc.sasc.biopet.core.ToolCommand
@@ -57,7 +56,7 @@ object BiopetFlagstat extends ToolCommand {
     val argsParser = new OptParser
     val commandArgs: Args = argsParser.parse(args, Args()) getOrElse sys.exit(1)
 
-    val inputSam = new SAMFileReader(commandArgs.inputFile)
+    val inputSam = SamReaderFactory.makeDefault.open(commandArgs.inputFile)
     val iterSam = if (commandArgs.region == None) inputSam.iterator else {
       val regionRegex = """(.*):(.*)-(.*)""".r
       commandArgs.region.get match {
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/CheckAllelesVcfInBam.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/CheckAllelesVcfInBam.scala
index 867eb36ad2b17e19cbb3b8d93bc894ef50c05dae..ad33d97fd9c8e990cc1ead72816f2f7ea665fc8b 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/CheckAllelesVcfInBam.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/CheckAllelesVcfInBam.scala
@@ -1,8 +1,6 @@
 package nl.lumc.sasc.biopet.tools
 
-import htsjdk.samtools.SAMFileReader
-import htsjdk.samtools.QueryInterval
-import htsjdk.samtools.SAMRecord
+import htsjdk.samtools.{ QueryInterval, SamReaderFactory, SAMRecord, SamReader }
 import htsjdk.variant.variantcontext.VariantContext
 import htsjdk.variant.variantcontext.VariantContextBuilder
 import htsjdk.variant.variantcontext.writer.AsyncVariantContextWriter
@@ -69,7 +67,8 @@ object CheckAllelesVcfInBam extends ToolCommand {
 
     if (commandArgs.bamFiles.size != commandArgs.samples.size)
       logger.warn("Number of samples is diffrent then number of bam files, left over will be removed")
-    val bamReaders: Map[String, SAMFileReader] = Map(commandArgs.samples zip commandArgs.bamFiles.map(x => new SAMFileReader(x)): _*)
+    val samReaderFactory = SamReaderFactory.makeDefault
+    val bamReaders: Map[String, SamReader] = Map(commandArgs.samples zip commandArgs.bamFiles.map(x => samReaderFactory.open(x)): _*)
     val bamHeaders = bamReaders.map(x => (x._1, x._2.getFileHeader))
 
     val reader = new VCFFileReader(commandArgs.inputFile, false)
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala
index b6c9690bc90b45c2f9376f69b574e73157f39f06..788934f4f817744a379403388407c37290f5abc5 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala
@@ -1,25 +1,6 @@
-/*
- * Copyright 2014 pjvan_thof.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package nl.lumc.sasc.biopet.tools
 
-import htsjdk.samtools.QueryInterval
-import htsjdk.samtools.SAMFileReader
-import htsjdk.samtools.ValidationStringency
-import htsjdk.samtools.SAMRecord
+import htsjdk.samtools.{ QueryInterval, SAMRecord, SamReaderFactory, ValidationStringency }
 import java.io.File
 import nl.lumc.sasc.biopet.core.ToolCommand
 import scala.io.Source
@@ -44,8 +25,9 @@ object FindRepeatsPacBio extends ToolCommand {
 
     val argsParser = new OptParser
     val commandArgs: Args = argsParser.parse(args, Args()) getOrElse sys.exit(1)
-    val bamReader = new SAMFileReader(commandArgs.inputBam)
-    bamReader.setValidationStringency(ValidationStringency.SILENT)
+    val bamReader = SamReaderFactory.makeDefault
+      .validationStringency(ValidationStringency.SILENT)
+      .open(commandArgs.inputBam)
     val bamHeader = bamReader.getFileHeader
 
     val header = List("chr", "startPos", "stopPos", "Repeat_seq", "repeatLength",
@@ -55,7 +37,7 @@ object FindRepeatsPacBio extends ToolCommand {
 
     for (
       bedLine <- Source.fromFile(commandArgs.inputBed).getLines;
-      val values = bedLine.split("\t"); if values.size >= 3
+      values = bedLine.split("\t"); if values.size >= 3
     ) {
       val interval = new QueryInterval(bamHeader.getSequenceIndex(values(0)), values(1).toInt, values(2).toInt)
       val bamIter = bamReader.query(Array(interval), false)
diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/MpileupToVcf.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/MpileupToVcf.scala
index 52b5df3f5c5f0d9f6c007e00a48722aece6785ee..9c364cf62da705beaa94cb682b59a33c7e3329ef 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/MpileupToVcf.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/MpileupToVcf.scala
@@ -115,7 +115,7 @@ object MpileupToVcf extends ToolCommand {
     class Counts(var forward: Int, var reverse: Int)
     for (
       line <- inputStream;
-      val values = line.split("\t");
+      values = line.split("\t");
       if values.size > 5
     ) {
       val chr = values(0)