diff --git a/MBB.py b/MBB.py
index 41798de7a36382634bc44564717fc102d2711220..c41bd14016e28310af806c6b4ff2d7459cb8b08e 100755
--- a/MBB.py
+++ b/MBB.py
@@ -136,43 +136,56 @@ def extract_all_todo_from_logdir(tool, logdir):
 
 
 ########################
-# cmd_gencodes(): what to do when '-c generate' is used (Generating the codes)
+# cmd_gencodes(): what to do when '-c generate -lev <1|2|>' is used (Generating the codes)
 ########################
 
-#### THIS IS OUTDATED 
-def cmd_gencodes():
-    if os.path.exists("/MBI/scripts/original_MBI_generators/CollArgGenerator.py"):  # Docker run
-        print("Docker run")
-        generators = glob.glob("/MBI/scripts/original_MBI_generators/*Generator.py")
-        dir = "/MBI/gencodes"
-    elif os.path.exists("../../scripts/original_MBI_generators/CollArgGenerator.py"):  # Local run, from logs dir
-        print("Local run, from tools' logs dir")
-        generators = glob.glob(f"{os.getcwd()}/../../scripts/original_MBI_generators/*Generator.py")
-        dir = "../../gencodes/"
-    elif os.path.exists("scripts/original_MBI_generators/CollArgGenerator.py"):  # Local run, from main dir
-        print("Local run, from MBI main dir")
-        generators = glob.glob(f"{os.getcwd()}/scripts/original_MBI_generators/*Generator.py")
-        dir = "gencodes/"
-    else:
-        raise Exception("Cannot find the codes' original_MBI_generators. Please report that bug.")
-    subprocess.run(f"rm -rf {dir} ; mkdir {dir}", shell=True, check=True)
+def cmd_gencodes(level):
     here = os.getcwd()
-    os.chdir(dir)
-    print(f"Generate the codes (in {os.getcwd()}): ", end='')
-    for generator in generators:
-        m = re.match("^.*?/([^/]*)Generator.py$", generator)
-        if m:
-            print(m.group(1), end=", ")
-        else:
-            print(generator, end=", ")
-        subprocess.run(f'../scripts/ensure_python3 {generator}', shell=True, check=True)
-    print("\nTest count: ", end='')
-    sys.stdout.flush()
-    subprocess.run("ls *.c|wc -l", shell=True, check=True)
-    subprocess.run("for n in *.c ; do cat -n $n > $n.txt ; done", shell=True, check=True)
+    if os.path.exists("/MBB/scripts/errors/"):  
+        #level = 2 
+        print(f"Generate level {level}")
+        subprocess.run(f'tar -xf real_world_data.csv.tar.gz', shell=True, check=True)
+        dir = "scripts/"
+        os.chdir(dir)
+        subprocess.run(f'PYTHONPATH=../ python3 main.py --generator_dir errors --level {level} --real_world_data ../output.csv', shell=True, check=True)
+    else:
+        raise Exception("Cannot find the generators. Please report that bug.")
     os.chdir(here)
 
 
+
+   # if os.path.exists("/MBI/scripts/original_MBI_generators/CollArgGenerator.py"):  # Docker run
+   #     print("Docker run")
+   #     generators = glob.glob("/MBI/scripts/original_MBI_generators/*Generator.py")
+   #     dir = "/MBI/gencodes"
+   # elif os.path.exists("../../scripts/original_MBI_generators/CollArgGenerator.py"):  # Local run, from logs dir
+   #     print("Local run, from tools' logs dir")
+   #     generators = glob.glob(f"{os.getcwd()}/../../scripts/original_MBI_generators/*Generator.py")
+   #     dir = "../../gencodes/"
+   # elif os.path.exists("scripts/original_MBI_generators/CollArgGenerator.py"):  # Local run, from main dir
+   #     print("Local run, from MBI main dir")
+   #     generators = glob.glob(f"{os.getcwd()}/scripts/original_MBI_generators/*Generator.py")
+   #     dir = "gencodes/"
+   # else:
+   #     raise Exception("Cannot find the codes' original_MBI_generators. Please report that bug.")
+   # subprocess.run(f"rm -rf {dir} ; mkdir {dir}", shell=True, check=True)
+   # here = os.getcwd()
+   # os.chdir(dir)
+   # print(f"Generate the codes (in {os.getcwd()}): ", end='')
+   # for generator in generators:
+   #     m = re.match("^.*?/([^/]*)Generator.py$", generator)
+   #     if m:
+   #         print(m.group(1), end=", ")
+   #     else:
+   #         print(generator, end=", ")
+   #     subprocess.run(f'../scripts/ensure_python3 {generator}', shell=True, check=True)
+   # print("\nTest count: ", end='')
+   # sys.stdout.flush()
+   # subprocess.run("ls *.c|wc -l", shell=True, check=True)
+   # subprocess.run("for n in *.c ; do cat -n $n > $n.txt ; done", shell=True, check=True)
+   # os.chdir(here)
+
+
 ########################
 # cmd_build(): what to do when '-c build' is used (building the tool, discarding the cache)
 ########################
@@ -1617,6 +1630,9 @@ parser.add_argument('-l', '--logs-dir', metavar='path', default="logs", type=pat
 parser.add_argument('-g', '--gencodes', metavar='path', default="gencodes", type=pathlib.Path,
                     help='path to directory of source files (default: gencodes)')
 
+parser.add_argument('-lev', '--level', metavar='int', default=2, type=int,
+                    help='Generation level to generate codes (default: 2)')
+
 parser.add_argument('-b', metavar='batch', default='1/1',
                     help="Limits the test executions to the batch #N out of M batches (Syntax: 'N/M'). To get 3 runners, use 1/3 2/3 3/3")
 
@@ -1658,7 +1674,10 @@ if args.c == 'all':
     cmd_run(rootdir=rootdir, toolname=args.x, batchinfo=args.b)
     cmd_html(rootdir, toolnames=arg_tools)
 elif args.c == 'generate':
-    cmd_gencodes()
+    if args.level:
+        cmd_gencodes(level=args.level)
+    else:
+        cmd_gencodes(level=2)
 elif args.c == 'build':
     for t in arg_tools:
         cmd_build(rootdir=rootdir, toolname=t)
diff --git a/README.md b/README.md
index 68f87e4c3d5725f68e0c67f6a68f28a168a54763..35a08fffa7318c842ea543731cb7b4a2a84df2f8 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,10 @@ docker run -v `pwd`:/MBB -it mbb:latest bash
 
 ## Generate the codes
 
+```
+python3 MBB.py -c generate --level 2
+```
+Or
 ```
 cd /MBB
 tar -xf real_world_data.csv.tar.gz