diff --git a/bwa.wdl b/bwa.wdl
index ba0023a3194c58e85b534d06371d6ab5a5e51184..d8ce3e3239a202f93de5ce25fbacd3e75bde6371 100644
--- a/bwa.wdl
+++ b/bwa.wdl
@@ -1,5 +1,7 @@
 version 1.0
 
+import "common.wdl" as common
+
 task Mem {
     input {
         String? preCommand
@@ -9,29 +11,59 @@ task Mem {
         String outputPath
         String? readgroup
 
+        String? picardJar
+
         Int threads = 1
         Int memory = 8
+        Int picardMemory = 4
     }
 
+    String picardPrefix = if defined(picardJar)
+        then "java -Xmx" + picardMemory + "G -jar " + picardJar
+        else "picard -Xmx" + picardMemory + "G"
+
+    # Post alt script from bwa
+    String altCommand = if (defined(bwaIndex.altIndex)) then "| bwa-postalt " + bwaIndex.altIndex else ""
+
+    # setNmMdAndUqTags is only required if alt sequences are added
+    String setNmMdAndUqTagsCommand = picardPrefix + " SetNmMdAndUqTags " +
+                                             " INPUT=/dev/stdin OUTPUT=" + outputPath +
+                                             " CREATE_INDEX=true" +
+                                             " R=" + bwaIndex.fastaFile
+
+    String sortSamCommand = picardPrefix + " SortSam " +
+                 " INPUT=/dev/stdin SORT_ORDER=coordinate " +
+                 if(defined(bwaIndex.altIndex)) then " OUTPUT=/dev/stdout "
+                 else " OUTPUT=" + outputPath + " CREATE_INDEX=true "
+
+    String picardCommand = if (defined(bwaIndex.altIndex)) then sortSamCommand + " | " + setNmMdAndUqTagsCommand
+    else sortSamCommand
+
+    String readgroupArg = if (defined(readgroup)) then "-R '" + readgroup + "'" else ""
+
     command {
         set -e -o pipefail
         mkdir -p $(dirname ~{outputPath})
         ~{preCommand}
         bwa mem ~{"-t " + threads} \
-        ~{"-R '" + readgroup + "'"} \
+        ~{readgroupArg} \
         ~{bwaIndex.fastaFile} \
         ~{inputR1} \
         ~{inputR2} \
-        | samtools sort --output-fmt BAM - > ~{outputPath}
+        ~{altCommand} \
+        | ~{picardCommand}
     }
 
     output {
-        File bamFile = outputPath
+        IndexedBamFile bamFile = object {
+          file: outputPath,
+          index: sub(outputPath, ".bam$", ".bai")
+        }
     }
 
     runtime{
         cpu: threads
-        memory: memory
+        memory: memory + picardMemory + picardMemory
     }
 }
 
@@ -62,8 +94,10 @@ task Index {
     }
 
     output {
-        File indexedFasta = outputFile
-        Array[File] indexFiles = [outputFile + ".bwt",outputFile + ".pac",outputFile + ".sa",outputFile + ".amb",outputFile + ".ann"]
+        BwaIndex outputIndex = object {
+            fastaFile: outputFile,
+            indexFiles: [outputFile + ".bwt",outputFile + ".pac",outputFile + ".sa",outputFile + ".amb",outputFile + ".ann"]
+        }
     }
 
     parameter_meta {
@@ -77,4 +111,5 @@ task Index {
 struct BwaIndex {
     File fastaFile
     Array[File] indexFiles
+    File? altIndex
 }
diff --git a/centrifuge.wdl b/centrifuge.wdl
index 4b128c33627eb4eec4facb184c4e49a321d4b4a7..9f82b7fc29796f4eda743c12cfbaefb34c06a85b 100644
--- a/centrifuge.wdl
+++ b/centrifuge.wdl
@@ -197,7 +197,7 @@ task Kreport {
         String suffix = "kreport"
         String prefix = "centrifuge"
         String indexPrefix
-        Boolean? onlyUnique
+        Boolean? onlyUnique ## removed in 1.0.4
         Boolean? showZeros
         Boolean? isCountTable
         Int? minScore
diff --git a/seqtk.wdl b/seqtk.wdl
index 64c604a5ecfe0beba399605dcabb1bb3de0ee59a..013d1d08f633f1ddf1a6253760c433bcc2b9c963 100644
--- a/seqtk.wdl
+++ b/seqtk.wdl
@@ -6,7 +6,7 @@ task Sample {
         String outFilePath = "subsampledReads.fq.gz"
         String? preCommand
         Int? seed
-        Boolean twoPassMode
+        Boolean twoPassMode = false
         Float? fraction
         Int? number
         Boolean zip = true
diff --git a/spades.wdl b/spades.wdl
index 47195f196967b8b1863b908d9c483ed49df9f978..09f4bb0af05d38d066149c4947e2d69cdf680fc6 100644
--- a/spades.wdl
+++ b/spades.wdl
@@ -32,7 +32,8 @@ task Spades {
         Int? phredOffset
     }
 
-    Int clusterMemory = ceil(memoryGb / threads)
+    Int clusterMemory = ceil(memoryGb / threads * 1.2)
+    Int memoryArg = ceil(memoryGb)
 
     command {
         set -e -o pipefail
@@ -60,7 +61,7 @@ task Spades {
         ~{true="--disable-rr" false="" disableRepeatResolution} \
         ~{"--dataset " + dataset} \
         ~{"--threads " + threads} \
-        ~{"--memory " + memoryGb} \
+        ~{"--memory " + memoryArg} \
         ~{"-k " + k} \
         ~{"--cov-cutoff " + covCutoff} \
         ~{"--phred-offset " + phredOffset}