diff --git a/src/code_.py b/src/code_.py
index adb4c763a48e35624335a22062949620069442f3..513b791929374bee63cef4c735aa98eb510962a6 100644
--- a/src/code_.py
+++ b/src/code_.py
@@ -157,6 +157,19 @@ class Code:
                         searching = True
                         index+=1
                         break
+            #For reduce
+            for match in re.finditer(r"(\.|\|)\s*reduce[^{]+{", code):
+                start_map, end = match.span(0)
+                end_map = extract_curly(code, end)
+                old = code[end:end_map-1]        
+                new = f"¤{id(self)}_{index}¤" 
+                self.add_map_element(old, new)
+                old_code = code[start_map:end_map]
+                new_code = f".{word}_modified {{ {new} }}"
+                code = code.replace(old_code, new_code)
+                searching = True
+                index+=1
+                break
             timeout+=1
         if(timeout>=constant.WHILE_UPPER_BOUND):
             raise BioFlowInsightError(f"The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to extract the inside of a 'map' operator. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to extract the inside of a 'map' operator")
diff --git a/src/workflow.py b/src/workflow.py
index 8df04afb85a6dbfaa38556c2ed191abaa26cec97..e993cafcf0ef359c76bd1eb86b649fbf11a27846 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -1083,7 +1083,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
         map_element_dico = self.map_element_dico
         
         if(self.duplicate): 
-
+            if(len(self.get_processes_called())==0):
+                raise BioFlowInsightError("There are no process calls in the workflow. BioFlow-Insight cannot rewrite the workflow in this case.", type="Rewrite Error")
             #Check that there are no cycles which will break the creation of the user view:
             edges_create_cycles = self.graph.get_edges_that_create_cycle()
             #if(len(edges_create_cycles)>0):
@@ -1112,9 +1113,6 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                 code = self.simplify_workflow_code()
                 self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs)
                     
-            if(len(self.get_processes_called())==0):
-                raise BioFlowInsightError("There are no process calls in the workflow. BioFlow-Insight cannot rewrite the workflow in this case.", type="Rewrite Error")
-
             #DETERMING WHICH SUBWORKFLOWS ARE BROKEN WITH THE CLUSTER
             def get_clusters_with_calls(clusters):
                 #Creating the clusters with calls instead of processes or subworkflows