diff --git a/src/main/java/common/ConfigurationTTool.java b/src/main/java/common/ConfigurationTTool.java
index 72e628a0a26d68268e74de656617ad8cf9904746..bf9193d5c653e8ec28673776c93ca04b38494a9f 100755
--- a/src/main/java/common/ConfigurationTTool.java
+++ b/src/main/java/common/ConfigurationTTool.java
@@ -83,6 +83,7 @@ public class ConfigurationTTool {
     public static String LOTOSPath = "";
     public static String LIBPath = "";
     public static String IMGPath = "";
+    public static String DocGenPath = "";
     public static String GGraphPath = "";
     public static String TGraphPath = "";
     public static String TToolUpdateURL = "";
@@ -417,6 +418,7 @@ public class ConfigurationTTool {
         sb.append("LOTOSPath: " + LOTOSPath + "\n");
         sb.append("LIBPath: " + LIBPath + "\n");
         sb.append("IMGPath: " + IMGPath + "\n");
+        sb.append("DocGenPath: " + DocGenPath + "\n");
         sb.append("GGraphPath: " + GGraphPath + "\n");
         sb.append("TGraphPath: " + TGraphPath + "\n");
         sb.append("\nTTool update:\n");
@@ -432,7 +434,7 @@ public class ConfigurationTTool {
         sb.append("JavaExecutePath: " + JavaExecutePath + "\n");
         sb.append("SimuJavaCodeDirectory: " + SimuJavaCodeDirectory + "\n");
         sb.append("TToolSimuClassPath: " + TToolSimuClassPath + "\n");
-
+        
         sb.append("\nDIPLODOCUS:\n");
         if (systemcOn) {
             sb.append("SystemCCodeDirectory: " + SystemCCodeDirectory + "\n");
@@ -573,6 +575,9 @@ public class ConfigurationTTool {
             nl = doc.getElementsByTagName("IMGPath");
             if (nl.getLength() > 0)
                 IMGPath(nl);
+            nl = doc.getElementsByTagName("DocGenPath");
+            if (nl.getLength() > 0)
+            	DocGenPath(nl);
             nl = doc.getElementsByTagName("GGraphPath");
             if (nl.getLength() > 0)
                 GGraphPath(nl);
@@ -991,6 +996,15 @@ public class ConfigurationTTool {
         }
     }
 
+    private static void DocGenPath(NodeList nl) throws MalformedConfigurationException {
+        try {
+            Element elt = (Element)(nl.item(0));
+            DocGenPath = elt.getAttribute("data");
+        } catch (Exception e) {
+            throw new MalformedConfigurationException(e.getMessage());
+        }
+    }
+
     private static void GGraphPath(NodeList nl) throws MalformedConfigurationException {
         try {
             Element elt = (Element)(nl.item(0));
diff --git a/src/main/java/ui/DocumentationGenerator.java b/src/main/java/ui/DocumentationGenerator.java
index 7d22d6f254a92834f897cbf5c9843da2e4eba492..26ceeb9237d068b82b4db39d8ac46b773fae1944 100644
--- a/src/main/java/ui/DocumentationGenerator.java
+++ b/src/main/java/ui/DocumentationGenerator.java
@@ -56,8 +56,13 @@ import ui.util.DefaultText;
 
 import javax.imageio.ImageIO;
 import javax.swing.*;
+
+import common.ConfigurationTTool;
+
 import java.awt.image.BufferedImage;
 import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -73,7 +78,7 @@ import java.util.Vector;
 public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIElement {
 
     // type
-    private Vector panels; // TURTLEPanels
+    private Vector<TURTLEPanel> panels; // TURTLEPanels
     private JTabbedPane mainTabbedPane;
     private int firstHeadingNumber = 1;
     private static String title = "TTool project:";
@@ -83,8 +88,9 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
     private String texIncludeFileName = "diag.tex";
     private String texFileNameSvg = "docsvg.tex";
     private String texIncludeFileNameSvg = "diagsvg.tex";
-    private String path;
-    private String projectName;
+    private final String path;
+
+	private String projectName;
 
     private int cpt, total; // For loops -> to know at which point it is of its algorithm
     private boolean finished = false;
@@ -99,18 +105,16 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
     private String includeLatexDoc;
     private String mainLatexDocSvg;
     private String includeLatexDocSvg;
-    
 
-
-    public DocumentationGenerator(Vector _panels, JTabbedPane _mainTabbedPane, String _path, String _projectName) {
+    public DocumentationGenerator(Vector<TURTLEPanel> _panels, JTabbedPane _mainTabbedPane, String _path, String _projectName) {
         panels = _panels;
         mainTabbedPane = _mainTabbedPane;
         path = _path + "/";
         projectName = _projectName;
 
-        int i,j;
-        for(i=0; i<panels.size(); i++) {
-            TURTLEPanel tp = (TURTLEPanel)(panels.elementAt(i));
+        //int i,j;
+        for( int i=0; i<panels.size(); i++) {
+            TURTLEPanel tp = panels.elementAt(i);
             total += tp.panels.size();
         }
     }
@@ -122,6 +126,10 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
     public String getDocumentation() {
         return doc;
     }
+    
+    public String getPath() {
+		return path;
+	}
 
     public String getMainLatexDocumentation() {
         return mainLatexDoc;
@@ -169,17 +177,41 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
         int i,j;
         cpt = 0;
         BufferedImage image;
-	String svgImg;
+        String svgImg;
         TURTLEPanel tp;
         TDiagramPanel tdp;
         File file1;
-        String tmp, tmpForRef;
-
+        //String tmp, tmpForRef;
+        
+        final File docFolder = new File( getPath() );
+        
+        if ( !docFolder.exists() ) {
+        	docFolder.mkdir();
+    
+    		final String makefileName = File.separator + "Makefile";
+        	final File makeFile = new File( ConfigurationTTool.IMGPath + makefileName );
+        	
+        	try {
+	        	if ( makeFile.exists() ) {
+	        		Files.copy( makeFile.toPath(), new File( getPath() + makefileName ).toPath() );
+	        	}
+	            
+	    		final String mliFileName = File.separator + "mli.mk";
+	        	final File mliFile = new File( ConfigurationTTool.IMGPath + mliFileName );
+	        	
+	        	if ( mliFile.exists() ) {
+	        		Files.copy( mliFile.toPath(), new File( getPath() + mliFileName ).toPath() );
+	        	}
+        	}
+        	catch( final IOException ex ) {
+        		ex.printStackTrace();
+        	}
+        }
 
-	mainLatexDoc = getLatexDocumentationHeader(projectName);
-	includeLatexDoc = getIncludeLatexDocumentationHeader(projectName);
-	mainLatexDocSvg = getLatexDocumentationHeaderSvg(projectName);
-	includeLatexDocSvg = getIncludeLatexDocumentationHeaderSvg(projectName);
+		mainLatexDoc = getLatexDocumentationHeader(projectName);
+		includeLatexDoc = getIncludeLatexDocumentationHeader(projectName);
+		mainLatexDocSvg = getLatexDocumentationHeaderSvg(projectName);
+		includeLatexDocSvg = getIncludeLatexDocumentationHeaderSvg(projectName);
 	
         doc = "";
         doc += "<html>\n";
@@ -189,14 +221,13 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
         doc +="<center><h1>" + title + "</h1></center>\n";
         doc +="<center><b><h1>" + projectName + "</h1></b></center>\n<br><br>\n";
 
-	docSvg = doc;
+        docSvg = doc;
 	
-
         for(i=0; i<panels.size(); i++) {
-            tp = (TURTLEPanel)(panels.elementAt(i));
+            tp = panels.elementAt(i);
 
-            tmp = mainTabbedPane.getTitleAt(i);
-            panelName = tmp;
+            String mainTitle = mainTabbedPane.getTitleAt(i);
+            panelName = mainTitle;
 
             /*if (tp instanceof TMLDesignPanel) {
                 tmp = "DIPLODOCUS Application Modeling: " + tmp;
@@ -208,145 +239,159 @@ public class DocumentationGenerator implements SteppedAlgorithm, StoppableGUIEle
                 tmp = "DIPLODOCUS Architecture / Mapping Modeling: " + tmp;
 		}*/
             if (tp instanceof DesignPanel) {
-                tmp = "TURTLE Design";
+            	mainTitle = "TURTLE Design";
             }
-            if (tp instanceof AnalysisPanel) {
-                tmp = "TURTLE Analysis";
+            else if (tp instanceof AnalysisPanel) {
+            	mainTitle = "TURTLE Analysis";
             }
-            if (tp instanceof DeploymentPanel) {
-                tmp = "TURTLE Deployment";
+            else if (tp instanceof DeploymentPanel) {
+            	mainTitle = "TURTLE Deployment";
             }
 
-	    tmp = Conversion.replaceAllChar(tmp, '_', "\\_");
+            // Issue #32: This should only be done for Latex
+//            tmp = Conversion.replaceAllChar(tmp, '_', "\\_");
 
-	    // HTML
-            doc += "<br>\n<h" + firstHeadingNumber + ">" + tmp + "</h" + firstHeadingNumber + ">\n";
-	    docSvg += "<br>\n<h" + firstHeadingNumber + ">" + tmp + "</h" + firstHeadingNumber + ">\n";
+            // HTML
+            doc += "<br>\n<h" + firstHeadingNumber + ">" + mainTitle + "</h" + firstHeadingNumber + ">\n";
+            docSvg += "<br>\n<h" + firstHeadingNumber + ">" + mainTitle + "</h" + firstHeadingNumber + ">\n";
 
-	    // Latex
-	    includeLatexDoc += "\\section{" + tmp + "}\n";
-	    includeLatexDocSvg += "\\section{" + tmp + "}\n";
+            // Latex
+            // Issue #32: This should only be done for Latex
+            final String latexMainTitle = Conversion.replaceAllChar( mainTitle, '_', "\\_" );
+		    includeLatexDoc += "\\section{" + latexMainTitle + "}\n";
+		    includeLatexDocSvg += "\\section{" + latexMainTitle + "}\n";
 	    
             for(j=0; j<tp.panels.size(); j++) {
                 if (go == false) {
                     return false;
                 }
+
                 tdp = tp.panels.elementAt(j);
 
-                tmp = tp.tabbedPane.getTitleAt(j);
+                String subTitle  = tp.tabbedPane.getTitleAt(j);
 
-		tmpForRef = Conversion.replaceAllChar(tmp, '_', "");
-		tmpForRef += tmpForRef + i + j;
-		tmp = Conversion.replaceAllChar(tmp, '_', "\\_");
-		
+				String tmpForRef = Conversion.replaceAllChar( subTitle, '_', "" );
+				tmpForRef += tmpForRef + i + j;
+//				tmp = Conversion.replaceAllChar(tmp, '_', "\\_");
 
                 if (tdp instanceof TMLActivityDiagramPanel) {
-                    tmp = "Behavior of Task: " + tmp;
+                	subTitle = "Behavior of Task: " + subTitle;
                 }
-
-		if (tdp instanceof AvatarSMDPanel) {
-                    tmp = "Behavior of Block: " + tmp;
+                else if (tdp instanceof AvatarSMDPanel) {
+                	subTitle = "Behavior of Block: " + subTitle;
                 }
-
-                if (tdp instanceof TActivityDiagramPanel) {
-                    tmp = "Behavior of TClass: " + tmp;
+                else  if (tdp instanceof TActivityDiagramPanel) {
+                	subTitle = "Behavior of TClass: " + subTitle;
                 }
-
-                if (tdp instanceof TMLTaskDiagramPanel) {
-                    tmp = "Task and communications between tasks";
+                else if (tdp instanceof TMLTaskDiagramPanel) {
+                	subTitle = "Task and communications between tasks";
                 }
-
-                if (tdp instanceof TMLArchiDiagramPanel) {
-                    tmp = "Architecture or Mapping of " + panelName;
-		}
-
-                if (tdp instanceof TDeploymentDiagramPanel) {
-                    tmp = "";
+                else if (tdp instanceof TMLArchiDiagramPanel) {
+                	subTitle = "Architecture or Mapping of " + panelName;
+                }
+                else if (tdp instanceof TDeploymentDiagramPanel) {
+                	subTitle = "";
                 }
 
-		String imgName = "img_" + i + "_" + j + ".png";
-		String imgNameSvg = "Vimg_" + i + "_" + j;
+				String imgName = "img_" + i + "_" + j + ".png";
+				
+				// Issue #32: Wrong name
+				String imgNameSvg = "img_" + i + "_" + j;
+			
+				// HTML
+                doc += "<h" + (firstHeadingNumber+1) + ">" + subTitle + "</h" + (firstHeadingNumber+1) + ">\n";
+                docSvg += "<h" + (firstHeadingNumber+1) + ">" + subTitle + "</h" + (firstHeadingNumber+1) + ">\n";
 		
-		// HTML
-                doc += "<h" + (firstHeadingNumber+1) + ">" + tmp + "</h" + (firstHeadingNumber+1) + ">\n";
-		docSvg += "<h" + (firstHeadingNumber+1) + ">" + tmp + "</h" + (firstHeadingNumber+1) + ">\n";
-
-		// Latex
-		includeLatexDoc += "\\subsection{" + tmp + "}\n";
-		includeLatexDoc += "Figures \\ref{fig:" + tmpForRef  + "} presents ...\n";
-		includeLatexDoc += "\\begin{figure*}[htb]\n\\centering\n";
-		includeLatexDoc += "\\includegraphics[width=\\textwidth]{" + imgName + "}\n";
-		includeLatexDoc += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; 
-
-		includeLatexDocSvg += "\\subsection{" + tmp + "}\n";
-		includeLatexDocSvg += "Figures \\ref{fig:" + tmpForRef  + "} presents ...\n";
-		includeLatexDocSvg += "\\begin{figure*}[htb]\n\\centering\n";
-		includeLatexDocSvg += "\\includegraphics[width=\\textwidth]{" + imgNameSvg + "-svg.pdf}\n";
-		includeLatexDocSvg += "\\caption{Diagram \"" + tmp + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; 
+				// Latex
+				final String latexSubtitle = Conversion.replaceAllChar( subTitle, '_', "\\_");
+				includeLatexDoc += "\\subsection{" + latexSubtitle + "}\n";
+				includeLatexDoc += "Figures \\ref{fig:" + tmpForRef  + "} presents ...\n";
+				includeLatexDoc += "\\begin{figure*}[htb]\n\\centering\n";
+				includeLatexDoc += "\\includegraphics[width=\\textwidth]{" + imgName + "}\n";
+				includeLatexDoc += "\\caption{Diagram \"" + latexSubtitle + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; 
 		
-		// Capturing the diagram		
+				includeLatexDocSvg += "\\subsection{" + latexSubtitle + "}\n";
+				includeLatexDocSvg += "Figures \\ref{fig:" + tmpForRef  + "} presents ...\n";
+				includeLatexDocSvg += "\\begin{figure*}[htb]\n\\centering\n";
+				includeLatexDocSvg += "\\includegraphics[width=\\textwidth]{" + imgNameSvg + "-svg.pdf}\n";
+				includeLatexDocSvg += "\\caption{Diagram \"" + latexSubtitle + "\"}\n\\label{fig:" + tmpForRef + "}\n\\end{figure*}\n\n"; 
+				
+				// Capturing the diagram		
                 image = tdp.performMinimalCapture();
-		svgImg = tdp.svgCapture();
+                svgImg = tdp.svgCapture();
                 file1 = new File(path+imgName);
-		//file2 = new File(imgNameSvg);
-                //frame.paint(frame.getGraphics());
+                
                 try {
                     // save captured image to PNG file
                     ImageIO.write(image, "png", file1);
-		    FileUtils.saveFile(path+imgNameSvg+".svg", svgImg);
+                    FileUtils.saveFile(path+imgNameSvg+".svg", svgImg);
                     //doc += "<center><img src=\"img_" + i + "_" + j + ".png\" align=\"middle\" title=\"" + tmp + "\"></center>\n";
-		    doc += "<center><img src=\"img_" + i + "_" + j + ".png\" align=\"middle\" title=\"" + tmp + "\"></center>\n";
-		    docSvg += "<center><img src=\"img_" + i + "_" + j + ".svg\" align=\"middle\" title=\"" + tmp + "\"></center>\n";
-                } catch (Exception e) {
+				    doc += "<center><img src=\"img_" + i + "_" + j + ".png\" align=\"middle\" title=\"" + subTitle + "\"></center>\n";
+				    docSvg += "<center><img src=\"img_" + i + "_" + j + ".svg\" align=\"middle\" title=\"" + subTitle + "\"></center>\n";
+                }
+                catch (Exception e) {
                     System.out.println("Image (" + i + ", " + j + ") could not be captured");
+                    e.printStackTrace();
                 }
+                
                 cpt ++;
             }
         }
 
         doc+="</body>\n</html>";
-	docSvg+="</body>\n</html>";
+        docSvg+="</body>\n</html>";
 
         try {
             FileUtils.saveFile(path+fileName, doc);	    
         } catch (FileException fe) {
+        	fe.printStackTrace();
             System.out.println("HTML file could not be saved");
+
             return false;
         }
 
-	try {
+        try {
             FileUtils.saveFile(path+fileNameSvg, docSvg);	    
         } catch (FileException fe) {
-            System.out.println("HTML file with svg img could not be saved");
-            return false;
+        	fe.printStackTrace();
+        	System.out.println("HTML file with svg img could not be saved");
+
+        	return false;
         }
 
-	try {
+        try {
             FileUtils.saveFile(path+texFileName, mainLatexDoc);	    
         } catch (FileException fe) {
+        	fe.printStackTrace();
             System.out.println("Main latex file could not be saved");
+
             return false;
         }
 
-	try {
+		try {
             FileUtils.saveFile(path+texIncludeFileName, includeLatexDoc);	    
         } catch (FileException fe) {
+        	fe.printStackTrace();
             System.out.println("Include latex file could not be saved");
-            return false;
-        }
 
+        	return false;
+        }
 	
-	try {
+		try {
             FileUtils.saveFile(path+texFileNameSvg, mainLatexDocSvg);	    
         } catch (FileException fe) {
+        	fe.printStackTrace();
             System.out.println("Main latex svg file could not be saved");
+
             return false;
         }
 
-	try {
+		try {
             FileUtils.saveFile(path+texIncludeFileNameSvg, includeLatexDocSvg);	    
         } catch (FileException fe) {
+        	fe.printStackTrace();
             System.out.println("include latex svg file could not be saved");
+
             return false;
         }
 	
diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java
index 3d72644cc0e857a8af2f220172f4e74357846c42..85020c636941f626fbd1d8105964a82690a9d8e6 100644
--- a/src/main/java/ui/MainGUI.java
+++ b/src/main/java/ui/MainGUI.java
@@ -5348,7 +5348,7 @@ public  class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
 
     public void generateDocumentation() {
         //TraceManager.addDev("Documentation");
-        ThreadGUIElement t = new ThreadGUIElement(frame, 1, tabs, mainTabbedPane, ConfigurationTTool.IMGPath, file.getName(),"Documentation", "Generating documentation ... Please wait");
+        ThreadGUIElement t = new ThreadGUIElement(frame, 1, tabs, mainTabbedPane, ConfigurationTTool.DocGenPath, file.getName(),"Documentation", "Generating documentation ... Please wait");
         t.go();
         /*DocumentationGenerator docgen = new DocumentationGenerator(tabs, mainTabbedPane, ConfigurationTTool.IMGPath, file.getName());
           docgen.setFirstHeadingNumber(2);
diff --git a/src/main/java/ui/ThreadGUIElement.java b/src/main/java/ui/ThreadGUIElement.java
index 2056315b337f82001f984f2a98fcc0261955299b..223cc38536dec18188bafae561dc3ed4d29c2294 100755
--- a/src/main/java/ui/ThreadGUIElement.java
+++ b/src/main/java/ui/ThreadGUIElement.java
@@ -53,6 +53,8 @@ import ui.window.JFrameStatistics;
 
 import javax.swing.*;
 import java.awt.*;
+import java.io.File;
+import java.io.IOException;
 import java.util.Vector;
 
 
@@ -64,7 +66,7 @@ import java.util.Vector;
  * @author Ludovic APVRILLE
  */
 public class ThreadGUIElement extends Thread {
-    private String param0, param1, param2, param3;
+    private String param0, param1, param2;//, param3;
     private Object obj0, obj1, obj2, obj3;
     private int function;
     private StoppableGUIElement sge;
@@ -88,7 +90,7 @@ public class ThreadGUIElement extends Thread {
         showStat = _showStat;
     }
 
-    public ThreadGUIElement (Frame _frame, int _function, String _param0, String _param1, String _param2) {
+    public ThreadGUIElement(Frame _frame, int _function, String _param0, String _param1, String _param2) {
         frame = _frame;
         function = _function;
         param0 = _param0;
@@ -96,7 +98,7 @@ public class ThreadGUIElement extends Thread {
         param2 = _param2;
     }
 
-    public ThreadGUIElement (Frame _frame, int _function, Object _obj0, Object _obj1, Object _obj2, Object _obj3, String _param0, String _param2) {
+    public ThreadGUIElement(Frame _frame, int _function, Object _obj0, Object _obj1, Object _obj2, Object _obj3, String _param0, String _param2) {
         frame = _frame;
         function = _function;
         obj0 = _obj0;
@@ -115,99 +117,116 @@ public class ThreadGUIElement extends Thread {
         sge = _sge;
     }
 
-    public void go() {
+    @SuppressWarnings("unchecked")
+	public void go() {
         if (ec != null) {
             jdc = new JDialogCancel(frame, param0, param1, sge);
-	    start();
+            start();
             GraphicLib.centerOnParent(jdc, 300, 200 );
             //   jdc.setSize(300, 200);
             jdc.setVisible(true);
             //jdc = null;
-        } else {
+        }
+        else {
             switch(function) {
             case 1:
-                docgen = new DocumentationGenerator((Vector)obj0, (JTabbedPane)obj1, (String)obj2, (String)obj3);
+                docgen = new DocumentationGenerator((Vector<TURTLEPanel>)obj0, (JTabbedPane)obj1, (String)obj2, (String)obj3);
                 docgen.setFirstHeadingNumber(2);
                 sge = docgen;
                 break;
             case 0:
             default:
-		TraceManager.addDev("Creating jframe statistics");
+            	TraceManager.addDev("Creating jframe statistics");
                 jfs = new JFrameStatistics(param0, param1, graph);
                 sge = jfs;
             }
-	    TraceManager.addDev("Dialog creation");
+            
+            TraceManager.addDev("Dialog creation");
             jdc = new JDialogCancel(frame, param0, param2, sge);
-	    start();
-            //  jdc.setSize(400, 200);
+            start();
             GraphicLib.centerOnParent(jdc, 400, 200 );
             jdc.setVisible(true);
-            //jdc = null;
         }
     }
 
+    @Override
     public void run() {
         Thread.currentThread().setPriority(Thread.NORM_PRIORITY - 1);
+        
         if (ec != null) {
-            //TraceManager.addDev("Starting computing function");
             ec.computeFunction(function);
-            //TraceManager.addDev("Ending computing function");
+
             if (jdc != null) {
-		//TraceManager.addDev("Stopping jdc");
                 jdc.stopAll();
-		jdc = null;
+                jdc = null;
             }
-        } else {
+        }
+        else {
             switch(function) {
             case 1:
                 boolean res = docgen.generateDocumentation();
                 if (jdc != null) {
                     jdc.stopAll();
                 }
-                if (res && !docgen.hasBeenStopped()) {
-                    JOptionPane.showMessageDialog(frame,
-                                                  "All done!",
-                                                  "Documentation generation",
-                                                  JOptionPane.INFORMATION_MESSAGE);
-                } else {
+            	
+            	// Issue #32: Inform on location of generated documentation
+            	final File folder = new File( docgen.getPath() );
+
+            	String canPath = null;
+            	
+				try {
+					canPath = folder.getCanonicalPath();
+				} catch ( final IOException e ) {
+					e.printStackTrace();
+					
+					canPath = docgen.getPath();
+				}
+
+				if ( res && !docgen.hasBeenStopped() ) {
+                    JOptionPane.showMessageDialog(	frame,
+//                                                  "All done!",
+                    								"Documentation generated successfully in directory '" + canPath + "'.",
+                    								"Documentation generation",
+                    								JOptionPane.INFORMATION_MESSAGE );
+                }
+                else {
                     JOptionPane.showMessageDialog(frame,
-                                                  "The documentation generation could not be performed",
-                                                  "     Error",
+                                                  "The documentation generation could not be performed for dirrectory '" + canPath + "'.",
+                                                  "Error",
                                                   JOptionPane.INFORMATION_MESSAGE);
                 }
+                
                 break;
             case 0:
             default:
-		//TraceManager.addDev("JFrameStatistics go Element");
                 jfs.goElement();
-                //TraceManager.addDev("go is done");
 
                 if (jfs.hasBeenStopped()) {
-                    //TraceManager.addDev("Stopped: not showing");
                     return;
                 }
+
                 if (jdc != null) {
                     jdc.stopAll();
                 }
 
-                //  jfs.setSize(600, 600);
                 if (showStat) {
                     jfs.setIconImage(IconManager.img8);
                     GraphicLib.centerOnParent(jfs, 600, 600 );
                     jfs.setVisible(true);
-                } else {
+                }
+                else {
                     // Display graph
                     jfs.displayGraph();
-
                 }
+
                 if (rg != null) {
                     rg.graph = jfs.getGraph();
+                
                     if (rg.graph != null) {
                         rg.data = null;
                     }
                 }
             }
         }
-
     }
 }
diff --git a/src/main/java/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/main/java/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
index f83804b4691e993c780123c0d715b7e97708d6bd..787909a88ab39bce244c2b1e674f5d9416c40493 100755
--- a/src/main/java/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
+++ b/src/main/java/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
@@ -1676,7 +1676,6 @@ public  class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar
             fileName += "simulationtrace_fromttool.txt";
         }
 
-
         if (ConfigurationTTool.isConfigured(ConfigurationTTool.IMGPath)) {
             fileName = ConfigurationTTool.IMGPath + System.getProperty("file.separator") + fileName;
         } else {
diff --git a/src/main/java/ui/window/JFrameRequirementTable.java b/src/main/java/ui/window/JFrameRequirementTable.java
index 99dcf56452bddabb0570d986a7a4bdb355aec49c..c93805ed0182595229e858eb0bc576213c8e3662 100755
--- a/src/main/java/ui/window/JFrameRequirementTable.java
+++ b/src/main/java/ui/window/JFrameRequirementTable.java
@@ -36,9 +36,6 @@
  * knowledge of the CeCILL license and that you accept its terms.
  */
 
-
-
-
 package ui.window;
 
 import common.ConfigurationTTool;
@@ -53,6 +50,8 @@ import javax.swing.table.AbstractTableModel;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.Vector;
@@ -65,6 +64,8 @@ import java.util.Vector;
  */
 public	class JFrameRequirementTable extends JFrame implements ActionListener /*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ {
 	
+	private static final String DOC_GEN_NAME = "tablereq.html";
+	
 	private Vector<TURTLEPanel> tabs;
 	
 	private java.util.List<AbstractTableModel> atms;
@@ -98,6 +99,7 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 	
 	public JFrameRequirementTable(String title, Vector<TURTLEPanel> _tabs, JTabbedPane _main, Point [] _pts) {
 		super(title);
+		
 		tabs = _tabs;
 		pts = _pts;
 		main = _main;
@@ -115,7 +117,6 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 		Container framePanel = getContentPane();
 		framePanel.setLayout(new BorderLayout());
 		
-		
 		JButton button1 = new JButton("Close", IconManager.imgic27);
 		button1.addActionListener(this);
 		buttonGenerate = new JButton("Generate doc.", IconManager.imgic29);
@@ -126,7 +127,6 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 		
 		framePanel.add(jp, BorderLayout.SOUTH);
 		
-		
     	// Issue #41 Ordering of tabbed panes 
 		mainTabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane();
 		
@@ -203,6 +203,7 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 		titles.add(title);
 	}
 	
+	@Override
 	public void	actionPerformed(ActionEvent evt)  {
 		String command = evt.getActionCommand();
 		//System.out.println("Command:" + command);
@@ -211,13 +212,37 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 			dispose();
 			return;
 		} else if (evt.getSource() == buttonGenerate) {
-			generateDoc();
+			
+			// Issue #32 Improve document generation
+			final File genFile = new File( ConfigurationTTool.DocGenPath );
+			String path;
+			
+			try {
+				path = genFile.getCanonicalPath();
+			} catch (IOException e) {
+				e.printStackTrace();
+				
+				path = genFile.getAbsolutePath();
+			}
+			
+			path += File.separator + DOC_GEN_NAME;
+
+			if ( generateDoc() ) {
+                JOptionPane.showMessageDialog(	this,
+												"Document '" + path + "' has been successfully generated.",
+												"Documentation Generation",
+												JOptionPane.INFORMATION_MESSAGE );
+			}
+			else {
+                JOptionPane.showMessageDialog( 	this,
+                								"Error generating document '" + path + "'.",
+						                        "Error",
+						                        JOptionPane.INFORMATION_MESSAGE);
+			}
 		} 
 	}
 	
-	
-	
-	private void generateDoc() {
+	private boolean generateDoc() {
 		TraceManager.addDev("Generate doc");
 		HTMLCodeGeneratorForTables doc = new HTMLCodeGeneratorForTables();
 		//String s = doc.getHTMLCode(atms, titles, "List of Requirements").toString();
@@ -225,26 +250,25 @@ public	class JFrameRequirementTable extends JFrame implements ActionListener /*,
 		TraceManager.addDev("HTML code:" + s); 
 		
 		String path;
-		if (ConfigurationTTool.IMGPath.length() > 0) {
-			path = ConfigurationTTool.IMGPath + "/";
+		if (ConfigurationTTool.DocGenPath.length() > 0) {
+			path = ConfigurationTTool.DocGenPath + "/";
 		} else {
 			path = "";
 		}
-		path += "tablereq.html";
+		path += DOC_GEN_NAME;//"tablereq.html";
 		
 		try {
 			FileUtils.saveFile(path, s);
 		} catch (FileException fe) {
+			fe.printStackTrace();
 			TraceManager.addDev("HTML file could not be saved in " + path);
-			return ;
+			
+			return false;
 		}
 		
-		TraceManager.addDev("File generated in " + path);
-		
+		return true;
 	}
 	
-	
-	
 //	
 //	private int maxLengthColumn(Component c, AbstractTableModel tm, int index) {
 //		int w = 0, wtmp;
diff --git a/ttool/launch_configurations/config.xml b/ttool/launch_configurations/config.xml
index 2f92d101789953dca7c8d21dd3c83935c3a9f7cc..8def1c551ac6b159d6506f11d174f74ac31a98f4 100755
--- a/ttool/launch_configurations/config.xml
+++ b/ttool/launch_configurations/config.xml
@@ -19,6 +19,7 @@
 <FILEPath data="../modeling" />
 <LIBPath data="../lib" />
 <IMGPath data="../figures" />
+<DocGenPath data="../document_generation" />
 <LOTOSPath data="../lotos" />
 <GGraphPath data="./launch_configurations/graphs" />
 <TGraphPath data="./launch_configurations/graphs" />
@@ -67,7 +68,7 @@
 
 <PLUGIN_JAVA_CODE_GENERATOR data="../plugins/CustomizerAvatarCodeGeneration.jar" />
 
-<LastOpenFile data="/home/dblouin/Projets/TTool/git/TTool/modeling/DIPLODOCUS/ZigBeeTutorial.xml"/>
+<LastOpenFile data="/home/dblouin/Projets/TTool/git/TTool/modeling/AVATAR/CoffeeMachine_Avatar.xml"/>
 
 
 
diff --git a/ttool/runtime/config.xml b/ttool/runtime/config.xml
index 53f354a1e984ae6955e56e0b60a19c5b57d8fb64..5d47f90c20ab0be13c40af68448a0b4ef99e7923 100755
--- a/ttool/runtime/config.xml
+++ b/ttool/runtime/config.xml
@@ -19,6 +19,7 @@
 <FILEPath data="../modeling" />
 <LIBPath data="../lib" />
 <IMGPath data="../figures" />
+<DocGenPath data="../document_generation" />
 <LOTOSPath data="../lotos" />
 <GGraphPath data="../graphs" />
 <TGraphPath data="../graphs" />