diff --git a/__pycache__/app_functions.cpython-39.pyc b/__pycache__/app_functions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..45b7d5b6b5a4d6b986b61f6b283ec4b4274fa578
Binary files /dev/null and b/__pycache__/app_functions.cpython-39.pyc differ
diff --git a/__pycache__/image_maker.cpython-39.pyc b/__pycache__/image_maker.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f628d10a2a3276b44b45ea3fa6899ceac7f8f375
Binary files /dev/null and b/__pycache__/image_maker.cpython-39.pyc differ
diff --git a/__pycache__/logic.cpython-39.pyc b/__pycache__/logic.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5597bf98296c0f6d31ddd7f58fa37fb81ab36d39
Binary files /dev/null and b/__pycache__/logic.cpython-39.pyc differ
diff --git a/__pycache__/parsing.cpython-39.pyc b/__pycache__/parsing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f89a1bf0ea84b3e6cfee52d2a2ddfe97922d679b
Binary files /dev/null and b/__pycache__/parsing.cpython-39.pyc differ
diff --git a/logic.py b/logic.py
index 8e8500c7ecfc0c5e2511dd4251eec810b464d940..164e586e5b5af9f5b8581b9b77f52602147baf78 100644
--- a/logic.py
+++ b/logic.py
@@ -262,10 +262,7 @@ def recognize_term(terme):
 
 
 def beta_reduction_totale(terme, path, saveImages=True):
-    if recognize_term(terme):
-        print("reduction infinie detectée ")
-        return terme
-    elif saveImages==False:
+    if saveImages==False:
         if beta_reduction(terme) != None:
             return beta_reduction_totale(beta_reduction(terme), path, False)
         return (terme)
@@ -482,9 +479,6 @@ def beta_reduction_choice_n(terme,n):
                     return None
 def beta_reduction_interactive(terme, at):
     global counters
-    if recognize_term(terme):
-        print(" reduction interminable detectee")
-        return terme
     if at != None:
         # print(annotated_to_string(at))
         choice = int(input("Choose a beta reduction: "))
diff --git a/main.py b/main.py
index 0e1d89d799c44b91ec73df5aa09c610849e37b3a..a717a7100b3042494ee136677db3d65ba18797cf 100644
--- a/main.py
+++ b/main.py
@@ -86,6 +86,9 @@ def return_main_menu():
 
 def run_beta_reduction_totale(terme,path='beta_reduction_totale'):
     terme = parsing.parseTerm(terme)
+    if logic.recognize_term(terme):
+        print(" terme infini detecté")
+        return None
     os.makedirs(path, exist_ok=True)# cree le rep si il existe pas, le vide si non
     if len(os.listdir(path)) > 0:
         logic.image_counter = 0
@@ -103,6 +106,9 @@ def run_beta_reduction_totale(terme,path='beta_reduction_totale'):
 
 def run_beta_reduction_interactive_totale(terme,path='beta_reduction_interactive_totale'):
     terme = parsing.parseTerm(terme)
+    if logic.recognize_term(terme):
+        print(" terme infini detecté")
+        return None
     os.makedirs(path, exist_ok=True)
     if len(os.listdir(path)) > 0:
         logic.image_counter = 0
@@ -272,16 +278,22 @@ def run_main_menu():
     if choice == 1:
         clear()
         terme1 = input('Enter a term: ')
-        run_beta_reduction_totale(terme1)
-        clear()
-        print('Done!')
+        k=run_beta_reduction_totale(terme1)
+        if k!=None:
+          clear()
+          print('Done!')
+        else:
+            time.sleep(2)
         return_main_menu()
     elif choice == 2:
         clear()
         terme2 = input('Enter a term: ')
-        run_beta_reduction_interactive_totale(terme2)
-        clear()
-        print('Done!')
+        v= run_beta_reduction_interactive_totale(terme2)
+        if v!=None:
+          clear()
+          print('Done!')
+        else:
+            time.sleep(2)
         return_main_menu()
     elif choice == 3:
         clear()