diff --git a/src/TMLTranslator.java b/src/TMLTranslator.java
index 2473eaf76178cb3296019c24fce1c1e934e351ae..7504b9a395f26a0bf1ee4bb62f29cbde51b9e7d7 100755
--- a/src/TMLTranslator.java
+++ b/src/TMLTranslator.java
@@ -353,10 +353,10 @@ public class TMLTranslator  {
         final IDiploSimulatorCodeGenerator map;
 //        tmltranslator.tomappingsystemc2.TML2MappingSystemC map;
         if (tmap == null) {
-            map = DiploSimulatorFactory.INSTANCE.createTranslator( tmlm );
+            map = DiploSimulatorFactory.INSTANCE.createCodeGenerator( tmlm );
         } 
         else {
-            map = DiploSimulatorFactory.INSTANCE.createTranslator( tmap );
+            map = DiploSimulatorFactory.INSTANCE.createCodeGenerator( tmap );
         }
         
         map.generateSystemC(debug, true);
diff --git a/src/dseengine/DSEConfiguration.java b/src/dseengine/DSEConfiguration.java
index e962e3440220cb144a79f5cfb28a2582908b695e..a58e97e15802e4d2a820c4b4ed774374770c97a7 100755
--- a/src/dseengine/DSEConfiguration.java
+++ b/src/dseengine/DSEConfiguration.java
@@ -671,7 +671,7 @@ public class DSEConfiguration implements Runnable  {
 		
 			// Generating code
 			TraceManager.addDev("\n\n\n**** Generating simulation code...");
-			final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createTranslator( tmap );
+			final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createCodeGenerator( tmap );
 //			TML2MappingSystemC map = new TML2MappingSystemC(tmap);
 			
 			try {
@@ -709,7 +709,7 @@ public class DSEConfiguration implements Runnable  {
 		
 		// Generating code
 		TraceManager.addDev("\n\n\n**** Generating simulation code from mapping...");
-		final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createTranslator( _tmlmap );
+		final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createCodeGenerator( _tmlmap );
 		
 		try {
 			map.generateSystemC(_debug, _optimize);
@@ -1247,7 +1247,7 @@ public class DSEConfiguration implements Runnable  {
 		
 		
 			TraceManager.addDev("\n\n\n**** Generating simulation code...");
-			final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createTranslator( tmap );
+			final IDiploSimulatorCodeGenerator map = DiploSimulatorFactory.INSTANCE.createCodeGenerator( tmap );
 //			TML2MappingSystemC map = new TML2MappingSystemC(tmap);
 			try {
 				map.generateSystemC(_debug, _optimize);
diff --git a/src/myutil/TraceManager.java b/src/myutil/TraceManager.java
index b19808c6c4452737a031ee138689585c8f61e2e8..3270c67eca808df3bd1b215dd7e1c5c8d902a7b1 100644
--- a/src/myutil/TraceManager.java
+++ b/src/myutil/TraceManager.java
@@ -46,6 +46,7 @@
 package myutil;
 
 public class TraceManager {
+	
     public final static int TO_CONSOLE = 0;
     public final static int TO_FILE = 1;
     public final static int TO_BUFFER = 2;
@@ -76,6 +77,15 @@ public class TraceManager {
         }
     }
 
+    public static void addError( 	final String message,
+    								final Throwable error ) {
+    	addError( message );
+    	
+    	if ( error != null ) {
+    		error.printStackTrace();
+    	}
+    }
+
     public static void addError(String _s) {
         switch(errPolicy) {
             case TO_CONSOLE:
diff --git a/src/tmltranslator/tomappingsystemc2/DiploSimulatorFactory.java b/src/tmltranslator/tomappingsystemc2/DiploSimulatorFactory.java
index 651d5702e98696630fc1940c057fd4f6b652ace9..546b79b62521987fb6e3a1631df4395a6db4f2b1 100644
--- a/src/tmltranslator/tomappingsystemc2/DiploSimulatorFactory.java
+++ b/src/tmltranslator/tomappingsystemc2/DiploSimulatorFactory.java
@@ -14,23 +14,23 @@ public class DiploSimulatorFactory {
 	private DiploSimulatorFactory() {
 	}
 	
-	public IDiploSimulatorCodeGenerator createTranslator(	final TMLModeling tmlModeling ) {
+	public IDiploSimulatorCodeGenerator createCodeGenerator( final TMLModeling tmlModeling ) {
 		return new DiploSimulatorCodeGenerator( tmlModeling );
 	}
 	
-	public IDiploSimulatorCodeGenerator createTranslator(	final TMLMapping tmlMapping ) {
+	public IDiploSimulatorCodeGenerator createCodeGenerator( final TMLMapping tmlMapping ) {
 		return new DiploSimulatorCodeGenerator( tmlMapping );
 	}
 	
-	public IDiploSimulatorCodeGenerator createTranslator(	final TMLModeling tmlModeling, 
-															final List<EBRDD> ebrdds, 
-															final List<TEPE> tepes ) {
+	public IDiploSimulatorCodeGenerator createCodeGenerator(	final TMLModeling tmlModeling, 
+																final List<EBRDD> ebrdds, 
+																final List<TEPE> tepes ) {
 		return new DiploSimulatorCodeGenerator( tmlModeling, ebrdds, tepes );
 	}
 	
-	public IDiploSimulatorCodeGenerator createTranslator(	final TMLMapping tmlMapping, 
-															final List<EBRDD> ebrdds, 
-															final List<TEPE> tepes ) {
+	public IDiploSimulatorCodeGenerator createCodeGenerator(	final TMLMapping tmlMapping, 
+																final List<EBRDD> ebrdds, 
+																final List<TEPE> tepes ) {
 		return new DiploSimulatorCodeGenerator( tmlMapping, ebrdds, tepes );
 	}
 }
diff --git a/src/ui/window/JDialogSystemCGeneration.java b/src/ui/window/JDialogSystemCGeneration.java
index 29da53423b24187fb62ea18a142d690a861951ae..2e58d1465231a587aaf86bcb1285d84a5170bc7f 100755
--- a/src/ui/window/JDialogSystemCGeneration.java
+++ b/src/ui/window/JDialogSystemCGeneration.java
@@ -697,8 +697,6 @@ public class JDialogSystemCGeneration extends javax.swing.JDialog implements Act
 
     private void generateCode() throws InterruptedException {
         String list;
-     //   int cycle = 0;
-
 
         jta.append("Generating SystemC code\n");
 
@@ -733,62 +731,20 @@ public class JDialogSystemCGeneration extends javax.swing.JDialog implements Act
 
         try {
             unitCycle = unitcycle.getText();
-          //  cycle = Integer.valueOf(unitCycle).intValue();
-        } catch (Exception e) {
+        }
+        catch ( Exception e) {
             jta.append("Wrong number of cycles: " + unitcycle.getText());
             jta.append("Aborting");
             jta.append("\n\nReady to process next command\n");
             checkMode();
             setButtons();
+            
             return;
         }
 
-        /*TML2SystemC tml2systc = new TML2SystemC(mgui.gtm.getTMLModeling());
-          tml2systc.generateSystemC(debugmode.isSelected());
-
-          testGo();
-          jta.append("SystemC code generation done\n");
-          //t2j.printJavaClasses();
-          try {
-          jta.append("Generating SystemC file\n");
-          pathCode = code1.getText();
-          tml2systc.saveFile(pathCode, "appmodel");
-          jta.append("SystemC file generated\n");
-          } catch (Exception e) {
-          jta.append("Could not generate SystemC file\n");
-          }*/
-
         selectedItem = versionSimulator.getSelectedIndex();
-        //System.out.println("Selected item=" + selectedItem);
+
         switch( selectedItem ) {        //Old SystemC generator
-            /*case 0: {
-              tmltranslator.tomappingsystemc.TML2MappingSystemC tml2systc;
-              if (mgui.gtm.getTMLMapping() == null) {
-              if (mgui.gtm.getArtificialTMLMapping() == null) {
-              tml2systc = new tmltranslator.tomappingsystemc.TML2MappingSystemC(mgui.gtm.getTMLModeling());
-              } else {
-              TraceManager.addDev("Using artifical mapping");
-              tml2systc = new tmltranslator.tomappingsystemc.TML2MappingSystemC(mgui.gtm.getArtificialTMLMapping());
-              }
-              }
-              else {
-              tml2systc = new tmltranslator.tomappingsystemc.TML2MappingSystemC(mgui.gtm.getTMLMapping());
-              }
-              tml2systc.generateSystemC(debugmode.isSelected(), optimizemode.isSelected());
-              testGo();
-              jta.append("SystemC code generation done\n");
-              //t2j.printJavaClasses();
-              try {
-              jta.append("Generating SystemC file\n");
-              pathCode = code1.getText();
-              tml2systc.saveFile(pathCode, "appmodel");
-              jta.append("SystemC files generated\n");
-              }
-              catch( Exception e ) {
-              jta.append("Could not generate SystemC file\n");
-              }
-              break;
-              }*/
         case 0: {       //Simulator without CPs (Daniel's version)
             // Making EBRDDs
             ArrayList<EBRDD> al = new ArrayList<EBRDD>();
@@ -804,63 +760,46 @@ public class JDialogSystemCGeneration extends javax.swing.JDialog implements Act
                 alTepe.add(tepe);
                 jta.append("Done.\n");
             }
-            /*EBRDDTranslator ebrddt;
-              EBRDDPanel ep;
-              EBRDD ebrdd;
-
-              for(int k=0; k<val.size(); k++) {
-              testGo();
-              ebrddt = new EBRDDTranslator();
-              ep = (EBRDDPanel)(val.get(k));
-              jta.append("EBRDD: " + ep.getName() + "\n");
-              ebrdd = ebrddt.generateEBRDD(ep, ep.getName());
-              jta.append("Checking syntax\n");
-              if (ebrddt.getErrors().size() > 0) {
-              jta.append("Syntax error: ignoring EBRDD\n\n");
-              } else {
-              jta.append("No Syntax error: EBRDD taken into account\n\n");
-              al.add(ebrdd);
-              }
-              }*/
 
             final IDiploSimulatorCodeGenerator tml2systc;
 
             // Generating code
             if (mgui.gtm.getTMLMapping() == null) {
                 if (mgui.gtm.getArtificialTMLMapping() == null) {
-                	tml2systc = DiploSimulatorFactory.INSTANCE.createTranslator( mgui.gtm.getTMLModeling(), al, alTepe );
+                	tml2systc = DiploSimulatorFactory.INSTANCE.createCodeGenerator( mgui.gtm.getTMLModeling(), al, alTepe );
                     //tml2systc = new tmltranslator.tomappingsystemc2.TML2MappingSystemC(mgui.gtm.getTMLModeling(), al, alTepe);
                 }
                 else {
                     TraceManager.addDev("Using artifical mapping");
-                    tml2systc = DiploSimulatorFactory.INSTANCE.createTranslator( mgui.gtm.getArtificialTMLMapping(), al, alTepe );
+                    tml2systc = DiploSimulatorFactory.INSTANCE.createCodeGenerator( mgui.gtm.getArtificialTMLMapping(), al, alTepe );
                     //tml2systc = new tmltranslator.tomappingsystemc2.TML2MappingSystemC(mgui.gtm.getArtificialTMLMapping(), al, alTepe);
                 }
             } 
             else {
-            	tml2systc = DiploSimulatorFactory.INSTANCE.createTranslator( mgui.gtm.getTMLMapping(), al, alTepe );
+            	tml2systc = DiploSimulatorFactory.INSTANCE.createCodeGenerator( mgui.gtm.getTMLMapping(), al, alTepe );
 //                tml2systc = new tmltranslator.tomappingsystemc2.TML2MappingSystemC(mgui.gtm.getTMLMapping(), al, alTepe);
             }
 
-            tml2systc.generateSystemC(debugmode.isSelected(), optimizemode.isSelected());
-            testGo();
-            jta.append("SystemC code generation done\n");
-
-            for(TEPE tep: alTepe) {
-                TraceManager.addDev(tep.toString());
-            }
-            //t2j.printJavaClasses();
             try {
+	            tml2systc.generateSystemC(debugmode.isSelected(), optimizemode.isSelected());
+	            testGo();
+	            jta.append("SystemC code generation done\n");
+	
+	            for(TEPE tep: alTepe) {
+	                TraceManager.addDev(tep.toString());
+	            }
                 jta.append("Generating SystemC file\n");
                 pathCode = code1.getText();
                 tml2systc.saveFile(pathCode, "appmodel");
                 jta.append("SystemC files generated\n");
-            } catch (Exception e) {
-                jta.append("Could not generate SystemC file\n");
+            }
+            catch ( final Exception ex ) {
+            	final String message = "Could not generate simulator code!";
+            	jta.append( message + System.lineSeparator() );
+            	TraceManager.addError( message );ex.printStackTrace();
             }
             break;
         }
-
         }
     }   //End of method generateCode()