diff --git a/modeling/AVATAR/AirbusDoor_V2.xml b/modeling/AVATAR/AirbusDoor_V2.xml
index 0b4cff91bf0d6910e51bcf5d6571e47106846c5e..b18133561923f2eb7715a049062d583ef7bdf8a4 100644
--- a/modeling/AVATAR/AirbusDoor_V2.xml
+++ b/modeling/AVATAR/AirbusDoor_V2.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="false" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="0" LAST_SELECTED_SUB_TAB="0">
+<TURTLEGMODELING version="1.0beta" ANIMATE_INTERACTIVE_SIMULATION="false" ACTIVATE_PENALTIES="true" UPDATE_INFORMATION_DIPLO_SIM="false" ANIMATE_WITH_INFO_DIPLO_SIM="true" OPEN_DIAG_DIPLO_SIM="false" LAST_SELECTED_MAIN_TAB="3" LAST_SELECTED_SUB_TAB="5">
 
 <Modeling type="Avatar MAD" nameTab="MADs" >
 <AvatarMADPanel name="Modeling Assumptions Diagram" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" >
@@ -1883,7 +1883,7 @@
 <MainCode value="}"/>
 <Optimized value="true" />
 <considerTimingOperators value="true" />
-<Validated value="" />
+<Validated value="OnboardPersons;KeyboardFailure;Passenger;Crew;FirstOfficer;Captain;Person;System;DoorAndLockButton;Keyboard;" />
 <Ignored value="" />
 
 <CONNECTOR type="5002" id="1199" >
@@ -1891,7 +1891,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="1198" />
-<P1  x="757" y="349" id="1455" />
+<P1  x="757" y="349" id="1480" />
 <P2  x="715" y="303" id="1354" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -1906,7 +1906,7 @@
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="1200" />
 <P1  x="715" y="205" id="1361" />
-<P2  x="757" y="134" id="1480" />
+<P2  x="757" y="134" id="1455" />
 <AutomaticDrawing  data="true" />
 <extraparam>
 <isd value="in lock()" />
@@ -2042,11 +2042,11 @@ in DoorAndLockButton
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="1249" >
 <father id="1374" num="0" />
-<cdparam x="71" y="280" />
-<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="558" y="184" />
+<sizeparam width="136" height="190" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
-<infoparam name="Block0" value="Captain" />
+<cdrectangleparam minX="0" maxX="527" minY="0" maxY="200" />
+<infoparam name="Block0" value="KeyboardFailure" />
 <TGConnectingPoint num="0" id="1225" />
 <TGConnectingPoint num="1" id="1226" />
 <TGConnectingPoint num="2" id="1227" />
@@ -2074,18 +2074,16 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="codeValue" value="1" type="8" typeOther="" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1274" >
 <father id="1374" num="1" />
-<cdparam x="71" y="386" />
-<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="319" y="175" />
+<sizeparam width="217" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
-<infoparam name="Block0" value="FirstOfficer" />
+<cdrectangleparam minX="0" maxX="446" minY="0" maxY="292" />
+<infoparam name="Block0" value="Passenger" />
 <TGConnectingPoint num="0" id="1250" />
 <TGConnectingPoint num="1" id="1251" />
 <TGConnectingPoint num="2" id="1252" />
@@ -2113,8 +2111,8 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="false" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="false" type="4" typeOther="" />
 <Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
@@ -2159,11 +2157,11 @@ in DoorAndLockButton
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1324" >
 <father id="1374" num="3" />
-<cdparam x="319" y="175" />
-<sizeparam width="217" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="71" y="386" />
+<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="446" minY="0" maxY="292" />
-<infoparam name="Block0" value="Passenger" />
+<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
+<infoparam name="Block0" value="FirstOfficer" />
 <TGConnectingPoint num="0" id="1300" />
 <TGConnectingPoint num="1" id="1301" />
 <TGConnectingPoint num="2" id="1302" />
@@ -2191,18 +2189,18 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="false" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="false" type="4" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
 <Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1349" >
 <father id="1374" num="4" />
-<cdparam x="558" y="184" />
-<sizeparam width="136" height="190" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="71" y="280" />
+<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="527" minY="0" maxY="200" />
-<infoparam name="Block0" value="KeyboardFailure" />
+<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
+<infoparam name="Block0" value="Captain" />
 <TGConnectingPoint num="0" id="1325" />
 <TGConnectingPoint num="1" id="1326" />
 <TGConnectingPoint num="2" id="1327" />
@@ -2230,7 +2228,9 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="codeValue" value="1" type="8" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
 
@@ -2432,11 +2432,11 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="1469" >
 <father id="1519" num="0" />
-<cdparam x="757" y="299" />
-<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="757" y="83" />
+<sizeparam width="250" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="751" minY="0" maxY="290" />
-<infoparam name="Block0" value="Keyboard" />
+<cdrectangleparam minX="0" maxX="751" minY="0" maxY="285" />
+<infoparam name="Block0" value="DoorAndLockButton" />
 <TGConnectingPoint num="0" id="1445" />
 <TGConnectingPoint num="1" id="1446" />
 <TGConnectingPoint num="2" id="1447" />
@@ -2464,8 +2464,9 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -2489,16 +2490,22 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in code(int codeValue)" attached="true" />
+<Signal value="in lock()" attached="true" />
+<Signal value="in unlock()" attached="true" />
+<Signal value="in open()" attached="true" />
+<Signal value="in close()" attached="true" />
+<Signal value="in enterCockpit()" attached="true" />
+<Signal value="in leaveCockpit()" attached="true" />
+<Signal value="in emergencyCall()" attached="false" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1494" >
 <father id="1519" num="1" />
-<cdparam x="757" y="83" />
-<sizeparam width="250" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="757" y="299" />
+<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="751" minY="0" maxY="285" />
-<infoparam name="Block0" value="DoorAndLockButton" />
+<cdrectangleparam minX="0" maxX="751" minY="0" maxY="290" />
+<infoparam name="Block0" value="Keyboard" />
 <TGConnectingPoint num="0" id="1470" />
 <TGConnectingPoint num="1" id="1471" />
 <TGConnectingPoint num="2" id="1472" />
@@ -2526,9 +2533,8 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
+<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -2552,13 +2558,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in lock()" attached="true" />
-<Signal value="in unlock()" attached="true" />
-<Signal value="in open()" attached="true" />
-<Signal value="in close()" attached="true" />
-<Signal value="in enterCockpit()" attached="true" />
-<Signal value="in leaveCockpit()" attached="true" />
-<Signal value="in emergencyCall()" attached="false" />
+<Signal value="in code(int codeValue)" attached="true" />
 </extraparam>
 </SUBCOMPONENT>
 
@@ -6188,7 +6188,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="3042" />
-<P1  x="839" y="296" id="3224" />
+<P1  x="839" y="296" id="3199" />
 <P2  x="802" y="303" id="3081" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -6203,7 +6203,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="3044" />
 <P1  x="802" y="205" id="3088" />
-<P2  x="1094" y="139" id="3199" />
+<P2  x="1094" y="139" id="3224" />
 <AutomaticDrawing  data="true" />
 <extraparam>
 <isd value="in lock()" />
@@ -6573,11 +6573,11 @@ in DoorAndLockButton
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="3213" >
 <father id="3263" num="0" />
-<cdparam x="1094" y="88" />
-<sizeparam width="212" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="839" y="246" />
+<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="1075" minY="0" maxY="293" />
-<infoparam name="Block0" value="DoorAndLockButton" />
+<cdrectangleparam minX="0" maxX="1037" minY="0" maxY="298" />
+<infoparam name="Block0" value="Keyboard" />
 <TGConnectingPoint num="0" id="3189" />
 <TGConnectingPoint num="1" id="3190" />
 <TGConnectingPoint num="2" id="3191" />
@@ -6605,9 +6605,8 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
+<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -6631,22 +6630,16 @@ in DoorAndLockButton
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in lock()" attached="true" />
-<Signal value="in unlock()" attached="true" />
-<Signal value="in open()" attached="true" />
-<Signal value="in close()" attached="true" />
-<Signal value="in enterCockpit()" attached="true" />
-<Signal value="in leaveCockpit()" attached="true" />
-<Signal value="in emergencyCall()" attached="false" />
+<Signal value="in code(int codeValue)" attached="true" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="3238" >
 <father id="3263" num="1" />
-<cdparam x="839" y="246" />
-<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="1094" y="88" />
+<sizeparam width="212" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="1037" minY="0" maxY="298" />
-<infoparam name="Block0" value="Keyboard" />
+<cdrectangleparam minX="0" maxX="1075" minY="0" maxY="293" />
+<infoparam name="Block0" value="DoorAndLockButton" />
 <TGConnectingPoint num="0" id="3214" />
 <TGConnectingPoint num="1" id="3215" />
 <TGConnectingPoint num="2" id="3216" />
@@ -6674,8 +6667,9 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -6699,7 +6693,13 @@ in DoorAndLockButton
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in code(int codeValue)" attached="true" />
+<Signal value="in lock()" attached="true" />
+<Signal value="in unlock()" attached="true" />
+<Signal value="in open()" attached="true" />
+<Signal value="in close()" attached="true" />
+<Signal value="in enterCockpit()" attached="true" />
+<Signal value="in leaveCockpit()" attached="true" />
+<Signal value="in emergencyCall()" attached="false" />
 </extraparam>
 </SUBCOMPONENT>
 
diff --git a/src/main/java/avatartranslator/directsimulation/AvatarSimulationRunner.java b/src/main/java/avatartranslator/directsimulation/AvatarSimulationRunner.java
index b2ea4418a407a7774b85ee24a24c6e5a7ff61e79..22c3da13fe92ef18631d3a9ca302b39fa7ca2e12 100644
--- a/src/main/java/avatartranslator/directsimulation/AvatarSimulationRunner.java
+++ b/src/main/java/avatartranslator/directsimulation/AvatarSimulationRunner.java
@@ -61,6 +61,8 @@ import java.util.List;
 
 public class AvatarSimulationRunner {
 
+   private static int MAX_NB_OF_TRANSACTIONS = 10000;
+
    private AvatarSpecification as;
    private boolean stop;
    private AvatarSpecificationSimulation ass;
@@ -85,7 +87,7 @@ public class AvatarSimulationRunner {
             listener.setSimulationDone(simulationIndex);
             ass = new AvatarSpecificationSimulation(as, null);
             listOfSimulations.add(ass);
-            ass.runSimulationToCompletion();
+            ass.runSimulationToCompletion(MAX_NB_OF_TRANSACTIONS);
             if (stop) {
                 break;
             }
diff --git a/src/main/java/avatartranslator/directsimulation/AvatarSpecificationSimulation.java b/src/main/java/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
index bda99bbbdd9856d5ba5b5b54f2f3897a4d8b4177..e30b98606d8bff059a0a283130241a7e73fac4a1 100644
--- a/src/main/java/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
+++ b/src/main/java/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
@@ -233,9 +233,13 @@ public class AvatarSpecificationSimulation {
     // Control function
 
     public void runSimulationToCompletion() {
+        runSimulationToCompletion(-1);
+    }
+
+    public void runSimulationToCompletion(int maxNbOfTransactions) {
         Thread t = new Thread() {
             public void run() {
-                runSimulation();
+                runSimulation(maxNbOfTransactions);
             }
         };
 
@@ -252,6 +256,10 @@ public class AvatarSpecificationSimulation {
     }
 
     public void runSimulation() {
+        runSimulation(-1);
+    }
+
+    public void runSimulation(int maxNbOfTransactions) {
         int index[];
         Vector<AvatarSimulationPendingTransaction> selectedTransactions;
 
@@ -360,7 +368,14 @@ public class AvatarSpecificationSimulation {
                             if (asi != null) {
                                 asi.updateTransactionAndTime(allTransactions.size(), clockValue);
                             }
-                            setState(GATHER);
+
+                            //TraceManager.addDev("Nb of transations: " + allTransactions.size() + " max: " + maxNbOfTransactions);
+                            if ((maxNbOfTransactions > 0) && (allTransactions.size() >= maxNbOfTransactions)){
+                                //TraceManager.addDev("Max nb of transactions reached: " + maxNbOfTransactions);
+                                setState(TERMINATED);
+                            } else {
+                                setState(GATHER);
+                            }
                         } else {
                             setState(TERMINATED);
                             TraceManager.addDev("Error when executing transaction");
@@ -502,7 +517,14 @@ public class AvatarSpecificationSimulation {
         notifyAll();
     }
 
-    public synchronized void newStateInSimulation() {
+    public synchronized void  
+     
+     
+     
+     
+
+
+    newStateInSimulation() {
         newState = true;
         notifyAll();
     }
@@ -1683,16 +1705,37 @@ public class AvatarSpecificationSimulation {
     public void fillValuesOfTimesOfBlockAttribute(AvatarBlock ab, AvatarAttribute aa, int indexOfAttribute, ArrayList<Double> toBeFilled) {
         String initialValue = aa.getInitialValue();
         int oldValue = 0;
-        if ((initialValue != null) && (initialValue.length() > 0)) {
-            oldValue = Integer.decode(initialValue);
+        if (aa.isInt()) {
+            if ((initialValue != null) && (initialValue.length() > 0)) {
+                oldValue = Integer.decode(initialValue);
+            }
+        } else if (aa.isBool()) {
+            if ((initialValue != null) && (initialValue.length() > 0)) {
+                if (initialValue.compareTo("true") == 0) {
+                    oldValue = 1;
+                } else {
+                    oldValue = 0;
+                }
+            }
         }
 
+
+
         toBeFilled.add(new Double(oldValue));
         toBeFilled.add(new Double(0));
 
         for(AvatarSimulationTransaction ast: allTransactions) {
             if (ast.block == ab) {
-                int newValue = Integer.decode(ast.attributeValues.get(indexOfAttribute));
+                int newValue = 0;
+                if (aa.isInt()) {
+                    newValue = Integer.decode(ast.attributeValues.get(indexOfAttribute));
+                } else if (aa.isBool()) {
+                    if ((ast.attributeValues.get(indexOfAttribute).compareTo("true")) == 0) {
+                        newValue = 1;
+                    } else {
+                        newValue = 0;
+                    }
+                }
                 if (newValue != oldValue) {
                     oldValue = newValue;
                     //TraceManager.addDev("Block " + ab.getName() + " / " + aa.getName() + ". Adding value " + newValue + " at time " +
@@ -1707,15 +1750,36 @@ public class AvatarSpecificationSimulation {
     public void fillLastValueAndTimeOfBlockAttribute(AvatarBlock ab, AvatarAttribute aa, int indexOfAttribute, ArrayList<Double> toBeFilled) {
         String initialValue = aa.getInitialValue();
         int oldValue = 0;
-        if ((initialValue != null) && (initialValue.length() > 0)) {
-            oldValue = Integer.decode(initialValue);
+        if (aa.isInt()) {
+            if ((initialValue != null) && (initialValue.length() > 0)) {
+                oldValue = Integer.decode(initialValue);
+            }
+        } else if (aa.isBool()) {
+            if ((initialValue != null) && (initialValue.length() > 0)) {
+                if (initialValue.compareTo("true") == 0) {
+                    oldValue = 1;
+                } else {
+                    oldValue = 0;
+                }
+            }
         }
 
+
         long oldTime = 0;
 
         for(AvatarSimulationTransaction ast: allTransactions) {
             if (ast.block == ab) {
-                int newValue = Integer.decode(ast.attributeValues.get(indexOfAttribute));
+                int newValue = 0;
+                if (aa.isInt()) {
+                    newValue = Integer.decode(ast.attributeValues.get(indexOfAttribute));
+                } else if (aa.isBool()) {
+                    if ((ast.attributeValues.get(indexOfAttribute).compareTo("true")) == 0) {
+                        newValue = 1;
+                    } else {
+                        newValue = 0;
+                    }
+                }
+
                 if (newValue != oldValue) {
                     oldValue = newValue;
                     oldTime = ast.clockValueWhenFinished;
diff --git a/src/main/java/myutil/JFrameStatistics.java b/src/main/java/myutil/JFrameStatistics.java
index 7a24f5a77bd1d13f49a5e57904b929eb95d4f1c3..8001bf3a0f789646b8bcf99885e3e20a9bb82891 100644
--- a/src/main/java/myutil/JFrameStatistics.java
+++ b/src/main/java/myutil/JFrameStatistics.java
@@ -76,7 +76,8 @@ import java.util.List;
  * @author Ludovic APVRILLE
  */
 public class JFrameStatistics extends JFrame implements ActionListener, GenericTree {
-    protected JButton buttonClose;
+    protected JButton buttonClose, buttonCloseAllTabs;
+    protected JCheckBox checkHistogram, checkPieChart;
     protected JScrollPane jsp;
     protected JTabbedPane mainPane;
 
@@ -131,7 +132,17 @@ public class JFrameStatistics extends JFrame implements ActionListener, GenericT
         mainPanel.add(split, BorderLayout.CENTER);
 
         JPanel topPanel = new JPanel();
-        buttonClose = new JButton("Close", IconManager.imgic27);
+
+        checkHistogram = new JCheckBox("Use histogram");
+        checkHistogram.setSelected(true);
+        topPanel.add(checkHistogram);
+        checkPieChart = new JCheckBox("Use Pie Chart");
+        checkPieChart.setSelected(true);
+        topPanel.add(checkPieChart);
+        buttonCloseAllTabs = new JButton("Close all tabs", IconManager.imgic27);
+        buttonCloseAllTabs.addActionListener(this);
+        topPanel.add(buttonCloseAllTabs);
+        buttonClose = new JButton("Close Window", IconManager.imgic27);
         buttonClose.addActionListener(this);
         topPanel.add(buttonClose);
         mainPanel.add(topPanel, BorderLayout.SOUTH);
@@ -146,6 +157,8 @@ public class JFrameStatistics extends JFrame implements ActionListener, GenericT
     public void actionPerformed(ActionEvent ae) {
         if (ae.getSource() == buttonClose) {
             quit();
+        } else if (ae.getSource() == buttonCloseAllTabs) {
+            closeAllTabs();
         }
     }
 
@@ -153,6 +166,10 @@ public class JFrameStatistics extends JFrame implements ActionListener, GenericT
         dispose();
     }
 
+    public void closeAllTabs() {
+        mainPane.removeAll();
+    }
+
 
     // Showing stats
     public void showStats(DataElement de) {
@@ -160,10 +177,13 @@ public class JFrameStatistics extends JFrame implements ActionListener, GenericT
             return;
         }
 
+        if (checkHistogram.isSelected()) {
+            showHistogram(de);
+        }
 
-
-        showHistogram(de);
-        showPieChart(de);
+        if (checkPieChart.isSelected()) {
+            showPieChart(de);
+        }
 
     }