diff --git a/workflow/main.nf b/workflow/main.nf
index a9a6f327a64ec13c7f7374690e15473fb5ddf581..148fe8ab9b57bdf04ad48a70eec0d0cc0d075f93 100755
--- a/workflow/main.nf
+++ b/workflow/main.nf
@@ -20,15 +20,33 @@ params.kitVersion = '3GEXv3'
 params.version = '3.1.0'
 params.astrocyte = false
 params.outDir = "${baseDir}/output"
-params.multiqcConf = "${baseDir}/conf/multiqc_config.yaml"
-params.references = "${baseDir}/../docs/references.md"
 
+// Variable error test
 if (params.kitVersion == "3GEXv3" && params.version == '2.1.1') {
   print("Cellranger Version 2.1.1 requires kitVersion 2")
   System.exit(32)	
 }
 
-// Assign variables if astrocyte
+// Define variables from input
+name = params.name
+designLocation = Channel
+  .fromPath(params.designFile)
+  .ifEmpty { exit 1, "design file not found: ${params.designFile}" }
+fastqList = Channel
+  .fromPath(params.fastq)
+  .flatten()
+  .map { file -> [ file.getFileName().toString(), file.toString() ].join("\t") }
+  .collectFile(name: 'fileList.tsv', newLine: true)
+refLocation = Channel
+  .fromPath(params.genomeLocationFull)
+  .ifEmpty { exit 1, "referene not found: ${params.genome}" }
+expectCells = params.expectCells
+forceCells = params.forceCells
+chemistryParam = params.chemistryParam
+version = params.version
+outDir = params.outDir
+
+// Define variables if astrocyte (or from config)
 if (params.astrocyte) {
   print("Running under astrocyte")
   params.genomeLocation = '/project/apps_database/cellranger/refdata-cellranger-'
@@ -49,30 +67,14 @@ if (params.astrocyte) {
 }
 params.genomeLocationFull = params.genomeLocation+params.genome
 
-// Define regular variables
-name = params.name
-designLocation = Channel
-  .fromPath(params.designFile)
-  .ifEmpty { exit 1, "design file not found: ${params.designFile}" }
-fastqList = Channel
-  .fromPath(params.fastq)
-  .flatten()
-  .map { file -> [ file.getFileName().toString(), file.toString() ].join("\t") }
-  .collectFile(name: 'fileList.tsv', newLine: true)
-refLocation = Channel
-  .fromPath(params.genomeLocationFull)
-  .ifEmpty { exit 1, "referene not found: ${params.genome}" }
-expectCells = params.expectCells
-forceCells = params.forceCells
-chemistryParam = params.chemistryParam
-version = params.version
-outDir = params.outDir
-multiqcConf = params.multiqcConf
-references = params.references
-
+// Define constant variables
+multiqcConf = "${baseDir}/conf/multiqc_config.yaml"
+references = "${baseDir}/../docs/references.md"
 
+/*
+ * checkDesignFile: check design file for errors
+ */
 process checkDesignFile {
-
   tag "${name}"
   module 'python/3.6.1-2-anaconda'
 
@@ -93,7 +95,6 @@ process checkDesignFile {
     fi
     python3 ${baseDir}/scripts/check_design.py -d \${noSpaceDesign} -f ${fastqList}
     """
-
 }
 
 
@@ -104,7 +105,6 @@ samples = designPaths
   .groupTuple()
   //.subscribe { println it }
 
-
 // Duplicate variables
 samples.into {
   samples211
@@ -130,9 +130,10 @@ chemistryParam301 = chemistryParam
 chemistryParam302 = chemistryParam
 chemistryParam310 = chemistryParam
 
-
+/*
+ * count211: run cellranger count version 2.1.1
+ */
 process count211 {
-
   queue '128GB,256GB,256GBv1,384GB'
   tag "${sample}"
   publishDir "${outDir}/${task.process}", mode: 'copy'
@@ -170,12 +171,12 @@ process count211 {
       sed -E 's/("([^"]*)")?(,|\$)/\\2\t/g' ${sample}/outs/metrics_summary.csv | tr -d "," | sed "s/^/${sample}\t/" > ${sample}_metrics_summary.tsv
       """
     }
-
 }
 
-
+/*
+ * count211: run cellranger count version 3.0.1
+ */
 process count301 {
-
   queue '128GB,256GB,256GBv1,384GB'
   tag "${sample}"
   publishDir "${outDir}/${task.process}", mode: 'copy'
@@ -214,12 +215,12 @@ process count301 {
       sed -E 's/("([^"]*)")?(,|\$)/\\2\t/g' ${sample}/outs/metrics_summary.csv | tr -d "," | sed "s/^/${sample}\t/" > ${sample}_metrics_summary.tsv
       """
     }
-
 }
 
-
+/*
+ * count211: run cellranger count version 3.0.2
+ */
 process count302 {
-
   queue '128GB,256GB,256GBv1,384GB'
   tag "${sample}"
   publishDir "${outDir}/${task.process}", mode: 'copy'
@@ -260,12 +261,12 @@ process count302 {
       sed -E 's/("([^"]*)")?(,|\$)/\\2\t/g' ${sample}/outs/metrics_summary.csv | tr -d "," | sed "s/^/${sample}\t/" > ${sample}_metrics_summary.tsv
       """
     }
-
 }
 
-
+/*
+ * count211: run cellranger count version 3.1.0
+ */
 process count310 {
-
   queue '128GB,256GB,256GBv1,384GB'
   tag "${sample}"
   publishDir "${outDir}/${task.process}", mode: 'copy'
@@ -305,12 +306,12 @@ process count310 {
       sed -E 's/("([^"]*)")?(,|\$)/\\2\t/g' ${sample}/outs/metrics_summary.csv | tr -d "," | sed "s/^/${sample}\t/" > ${sample}_metrics_summary.tsv
       """
     }
-
 }
 
-
+/*
+ * versions: collect too versions into a single yml
+ */
 process versions {
-
   tag "${name}"
   module 'python/3.6.1-2-anaconda:pandoc/2.7:multiqc/1.7'
 
@@ -329,15 +330,15 @@ process versions {
     python3 "${baseDir}/scripts/generate_versions.py" -f version_*.txt -o versions
     python3 "${baseDir}/scripts/generate_references.py" -r "${references}" -o references
     """
-
 }
 
-
+// Collect all metrics summaries reguardless of cellranger version
 metricsSummary = metricsSummary211.mix(metricsSummary301, metricsSummary302, metricsSummary310)
 
-
+/*
+ * multiqc: create multiqc report
+ */
 process multiqc {
-
   tag "${name}"
   publishDir "${outDir}/${task.process}/${name}", mode: 'copy'
   module 'multiqc/1.7'
@@ -357,5 +358,4 @@ process multiqc {
     sed -i '1s/^.*\tE/Sample\tE/' metrics_summary_mqc.tsv
     multiqc -c ${multiqcConf} .
     """
-
 }