diff --git a/bwa.wdl b/bwa.wdl
index 01d1b7d08b798083d0bb7dbf6fd74ce4ebe64a14..ba0023a3194c58e85b534d06371d6ab5a5e51184 100644
--- a/bwa.wdl
+++ b/bwa.wdl
@@ -5,8 +5,7 @@ task Mem {
         String? preCommand
         File inputR1
         File? inputR2
-        File referenceFasta
-        Array[File] indexFiles # These indexFiles need to be added, otherwise cromwell will not find them.
+        BwaIndex bwaIndex
         String outputPath
         String? readgroup
 
@@ -20,7 +19,7 @@ task Mem {
         ~{preCommand}
         bwa mem ~{"-t " + threads} \
         ~{"-R '" + readgroup + "'"} \
-        ~{referenceFasta} \
+        ~{bwaIndex.fastaFile} \
         ~{inputR1} \
         ~{inputR2} \
         | samtools sort --output-fmt BAM - > ~{outputPath}
@@ -75,3 +74,7 @@ task Index {
     }
 }
 
+struct BwaIndex {
+    File fastaFile
+    Array[File] indexFiles
+}