diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d40cd1f1d7f4692517a395f3e9b589edc550a9b..126f1ed9aa60503f8793f43f60ae2f2b233b9cb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ Newest changes should be on top.
 This document is user facing. Please word the changes in such a way
 that users understand how the changes affect the new version.
 -->
+version 5.1.0-dev
+---------------------------
++ Update parameter_meta for macs2
++ Add sample position in array task.
+
 version 5.0.2
 ---------------------------
 + bumped ScatterRegions container to 1.0.0
diff --git a/common.wdl b/common.wdl
index d29ed5daf6f0e7355efe5bcd43265fc69bfe4aa5..1e4fc8cbac6317db2dd44276e50e99ebe031d90e 100644
--- a/common.wdl
+++ b/common.wdl
@@ -148,6 +148,44 @@ task CreateLink {
     }
 }
 
+task GetSamplePositionInArray {
+    input {
+        Array[String] sampleIds
+        String sample
+
+        # python:3.7-slim's sha256 digest. This image is based on debian buster.
+        String dockerImage = "python@sha256:e0f6a4df17d5707637fa3557ab266f44dddc46ebfc82b0f1dbe725103961da4e"
+    }
+
+    command <<<
+        python <<CODE
+        samples = ['~{sep="','" sampleIds}']
+        print(samples.index('~{sample}'))
+        CODE
+    >>>
+
+    output {
+        Int position = read_int(stdout())
+    }
+
+    runtime {
+        # 4 gigs of memory to be able to build the docker image in singularity.
+        memory: "4G"
+        docker: dockerImage
+        timeMinutes: 5
+    }
+
+    parameter_meta {
+        # inputs
+        sampleIds: {description: "A list of sample ids.", category: "required"}
+        sample: {description: "The sample for which the position is wanted.", category: "required"}
+        dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
+
+        # outputs
+        position: {description: ""}
+    }
+}
+
 task MapMd5 {
     input {
         Map[String,String] map
diff --git a/macs2.wdl b/macs2.wdl
index 757eaf677281e992839e4a751527609b32743af2..eb71ac1dd8ba5fe7e165068d97ecfb870d1befa6 100644
--- a/macs2.wdl
+++ b/macs2.wdl
@@ -24,13 +24,12 @@ task PeakCalling {
     input {
         Array[File]+ inputBams
         Array[File]+ inputBamsIndex
-        Array[File]+? controlBams
-        Array[File]+? controlBamsIndex
-        String outDir
+        Array[File] controlBams
+        Array[File] controlBamsIndex
+        String outDir = "macs2"
         String sampleName
         Boolean nomodel = false
-
-        Int threads = 1
+        Int timeMinutes = 600  # Default to 10 hours
         String memory = "8G"
         String dockerImage = "quay.io/biocontainers/macs2:2.1.2--py27r351_0"
     }
@@ -39,7 +38,7 @@ task PeakCalling {
         set -e
         macs2 callpeak \
         --treatment ~{sep = ' ' inputBams} \
-        ~{true="--control" false="" defined(controlBams)} ~{sep = ' ' controlBams} \
+        ~{true="--control" false="" length(controlBams) > 0} ~{sep = ' ' controlBams} \
         --outdir ~{outDir} \
         --name ~{sampleName} \
         ~{true='--nomodel' false='' nomodel}
@@ -50,8 +49,22 @@ task PeakCalling {
     }
 
     runtime {
-        cpu: threads
+        cpu: 1
         memory: memory
         docker: dockerImage
+        time_minutes: timeMinutes
+    }
+    parameter_meta {
+        inputBams: {description: "The BAM files on which to perform peak calling.", category: "required"}
+        inputBamsIndex: {description: "The indexes for the input BAM files.", category: "required"}
+        controlBams: {description: "Control BAM files for the input bam files.", category: "common"}
+        controlBamsIndex: {description: "The indexes for the control BAM files.", category: "common"}
+        sampleName: {description: "Name of the sample to be analysed", category: "required"}
+        outDir: {description: "All output files will be written in this directory.", category: "advanced"}
+        nomodel: {description: "Whether or not to build the shifting model.", category: "advanced"}
+        memory: {description: "The amount of memory this job will use.", category: "advanced"}
+        timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
+        dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
+
     }
 }