diff --git a/src/main/java/tmltranslator/TMLActivityElementWithAction.java b/src/main/java/tmltranslator/TMLActivityElementWithAction.java
index c62a29c83290f0f801d7135d3196a0817fa57115..5e2fad559e09082f1bff8ec42d6d1e2e1a7f1141 100755
--- a/src/main/java/tmltranslator/TMLActivityElementWithAction.java
+++ b/src/main/java/tmltranslator/TMLActivityElementWithAction.java
@@ -52,29 +52,13 @@ import java.util.Objects;
  * @author Ludovic APVRILLE
  */
 public abstract class TMLActivityElementWithAction extends TMLActivityElement {
-    public final static int ENCRYPTION_PROCESS = 1;
-    public final static int DECRYPTION_PROCESS = 2;
 
-    private boolean isDecryptionProcess = false;
     protected String action;
 
     public TMLActivityElementWithAction(String _name, Object _referenceObject) {
         super(_name, _referenceObject);
     }
 
-    public boolean isDecryptionProcess() {
-        return isDecryptionProcess;
-    }
-
-    public void setDecryptionProcess(boolean decryption) throws TMLCheckingError {
-        isDecryptionProcess = decryption;
-        if (decryption) {
-            if (getSecurityPattern() == null) {
-                throw new TMLCheckingError(CheckingError.STRUCTURE_ERROR, "No security Pattern for " + this.getName());
-            }
-        }
-    }
-
     public void setAction(String _action) {
         action = _action;
     }
diff --git a/src/main/java/tmltranslator/TMLExecC.java b/src/main/java/tmltranslator/TMLExecC.java
index 1d6058339a6c1a25304fe6f4c1193c3582ea08ff..7f072c862807a19dc5e43f0515b8e2fa431a1cbb 100755
--- a/src/main/java/tmltranslator/TMLExecC.java
+++ b/src/main/java/tmltranslator/TMLExecC.java
@@ -42,6 +42,8 @@
 package tmltranslator;
 
 
+import translator.CheckingError;
+
 /**
  * Class TMLExecC
  * Creation: 21/05/2008
@@ -50,10 +52,24 @@ package tmltranslator;
  */
 public class TMLExecC extends TMLActivityElementWithAction {
 
+    private boolean isDecryptionProcess = false;
     public TMLExecC(String _name, Object _referenceObject) {
          super(_name, _referenceObject);
     }
 
+    public boolean isDecryptionProcess() {
+        return isDecryptionProcess;
+    }
+
+    public void setDecryptionProcess(boolean decryption) throws TMLCheckingError {
+        isDecryptionProcess = decryption;
+        if (decryption) {
+            if (getSecurityPattern() == null) {
+                throw new TMLCheckingError(CheckingError.STRUCTURE_ERROR, "No security Pattern for " + this.getName());
+            }
+        }
+    }
+
     public  TMLExecC deepClone(TMLModeling tmlm) throws TMLCheckingError {
         TMLExecC newElt = new TMLExecC(getName(), getReferenceObject());
         fillValues(newElt, tmlm);
diff --git a/src/main/java/tmltranslator/TMLTextSpecification.java b/src/main/java/tmltranslator/TMLTextSpecification.java
index a6ec1b914c2288c6ff1c16fd7a92652c129d2386..827bb057ef18130a2055637f94f8c47c529e3cd5 100755
--- a/src/main/java/tmltranslator/TMLTextSpecification.java
+++ b/src/main/java/tmltranslator/TMLTextSpecification.java
@@ -77,6 +77,9 @@ public class TMLTextSpecification<E> {
 
     public final static String EMPTY_KEY_NONCE = "-";
 
+    public final static int ENCRYPTION_PROCESS = 1;
+    public final static int DECRYPTION_PROCESS = 2;
+
 
     private String spec;
     private String title;
@@ -442,7 +445,7 @@ public class TMLTextSpecification<E> {
                 if (key.length() == 0) {
                     key = EMPTY_KEY_NONCE;
                 }
-                int process = (((TMLExecC) elt).isDecryptionProcess()) ? TMLExecC.DECRYPTION_PROCESS : TMLExecC.ENCRYPTION_PROCESS;
+                int process = (((TMLExecC) elt).isDecryptionProcess()) ? DECRYPTION_PROCESS : ENCRYPTION_PROCESS;
                 code = "EXECC" + SP + modifyString(((TMLExecC) elt).getAction()) + SP + elt.getSecurityPattern().getName() + SP + type + SP +
                         elt.getSecurityPattern().getEncTime() + SP + elt.getSecurityPattern().getDecTime() + SP + elt.getSecurityPattern().getOverhead() + SP +
                         elt.getSecurityPattern().getSize() + SP + nonce + SP + key + SP + process + CR;
@@ -779,7 +782,7 @@ public class TMLTextSpecification<E> {
         boolean isNewSec = true;
         if (_split.length > 10) {
             TraceManager.addDev("Found EXECC in: " + _split.length + " name=" + _split[2] + " type=" + _split[3]);
-            if (_split[10].compareTo("" + TMLExecC.ENCRYPTION_PROCESS) == 0) {
+            if (_split[10].compareTo("" + ENCRYPTION_PROCESS) == 0) {
                 String ccName = _split[2];
                 if (securityPatternMap.containsKey(ccName)) {
                     isNewSec = false;
@@ -2784,13 +2787,13 @@ public class TMLTextSpecification<E> {
 
             if (_split.length == 11) {
                 if (securityPatternMap.containsKey(_split[2])) {
-                    if ((_split[10].compareTo("" + TMLExecC.DECRYPTION_PROCESS) == 0) || (_split[10].compareTo("" + TMLExecC.ENCRYPTION_PROCESS) == 0)) {
+                    if ((_split[10].compareTo("" + DECRYPTION_PROCESS) == 0) || (_split[10].compareTo("" + ENCRYPTION_PROCESS) == 0)) {
                         //Security operation
                         TraceManager.addDev("Found security pattern: " + _split[2]);
                         TMLExecC execc = new TMLExecC("encrypt_" + _split[2], null);
                         execc.setAction(_split[1]);
                         execc.setSecurityPattern(securityPatternMap.get(_split[2]));
-                        if (_split[10].compareTo("" + TMLExecC.DECRYPTION_PROCESS) == 0) {
+                        if (_split[10].compareTo("" + DECRYPTION_PROCESS) == 0) {
                             execc.setDecryptionProcess(true);
                             execc.setName("decrypt_" + _split[2]);
                         }
diff --git a/src/main/java/tmltranslator/toavatar/FullTML2Avatar.java b/src/main/java/tmltranslator/toavatar/FullTML2Avatar.java
index 914deb780fe4352c1065b3645599e8cda61587aa..ee220ce6f86704a9d5cb09f319bbf8aac9c3321b 100644
--- a/src/main/java/tmltranslator/toavatar/FullTML2Avatar.java
+++ b/src/main/java/tmltranslator/toavatar/FullTML2Avatar.java
@@ -64,32 +64,32 @@ public class FullTML2Avatar {
     private Map<SecurityPattern, List<AvatarAttribute>> pubKeys = new HashMap<SecurityPattern, List<AvatarAttribute>>();
     private Map<String, String> nameMap = new HashMap<String, String>();
     //private AvatarAttribute pKey;
-    public Map<TMLChannel, Integer> channelMap = new HashMap<TMLChannel, Integer>();
-    public Map<TMLTask, AvatarBlock> taskBlockMap = new HashMap<TMLTask, AvatarBlock>();
-    public Map<String, Integer> originDestMap = new HashMap<String, Integer>();
+    private Map<TMLChannel, Integer> channelMap = new HashMap<TMLChannel, Integer>();
+    private Map<TMLTask, AvatarBlock> taskBlockMap = new HashMap<TMLTask, AvatarBlock>();
+    private Map<String, Integer> originDestMap = new HashMap<String, Integer>();
     private Map<String, AvatarSignal> signalInMap = new HashMap<String, AvatarSignal>();
     private Map<String, AvatarSignal> signalOutMap = new HashMap<String, AvatarSignal>();
     private Map<TMLRequest, AvatarSignal> signalRequest = new HashMap<TMLRequest, AvatarSignal>();
-    public Map<String, Object> stateObjectMap = new HashMap<String, Object>();
-    public Map<TMLTask, List<SecurityPattern>> accessKeys = new HashMap<TMLTask, List<SecurityPattern>>();
+    private Map<String, Object> stateObjectMap = new HashMap<String, Object>();
+    private Map<TMLTask, List<SecurityPattern>> accessKeys = new HashMap<TMLTask, List<SecurityPattern>>();
 
-    HashMap<TMLChannel, Set<AvatarPragma>> secChannelMap = new HashMap<TMLChannel, Set<AvatarPragma>>();
+    private HashMap<TMLChannel, Set<AvatarPragma>> secChannelMap = new HashMap<TMLChannel, Set<AvatarPragma>>();
 
-    HashMap<String, AvatarAttributeState> signalAuthOriginMap = new HashMap<String, AvatarAttributeState>();
-    HashMap<String, AvatarAttributeState> signalAuthDestMap = new HashMap<String, AvatarAttributeState>();
+    private HashMap<String, AvatarAttributeState> signalAuthOriginMap = new HashMap<String, AvatarAttributeState>();
+    private HashMap<String, AvatarAttributeState> signalAuthDestMap = new HashMap<String, AvatarAttributeState>();
 
     private ArrayList<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>();
 
-    List<AvatarSignal> signals = new ArrayList<AvatarSignal>();
+    private List<AvatarSignal> signals = new ArrayList<AvatarSignal>();
     private final static Integer channelPublic = 0;
     private final static Integer channelPrivate = 1;
     private final static Integer channelUnreachable = 2;
-    public int loopLimit = 1;
-    AvatarSpecification avspec;
-    ArrayList<String> attrsToCheck;
-    List<String> allStates;
-    boolean mc = true;
-    boolean security = false;
+    private int loopLimit = 1;
+    private AvatarSpecification avspec;
+    private ArrayList<String> attrsToCheck;
+    private List<String> allStates;
+    private boolean mc = true;
+    private boolean security = false;
 
     private Object referenceObject;
 
@@ -1145,9 +1145,9 @@ public class FullTML2Avatar {
             elementList.add(as);
             elementList.add(tran);
 
-            if (security && ae.getSecurityPattern() != null) {
+            if (security && ae.getSecurityPattern() != null && ae instanceof TMLExecC) {
                 //If encryption
-                if (!((TMLActivityElementWithAction) ae).isDecryptionProcess()) {
+                if (!((TMLExecC) ae).isDecryptionProcess()) {
                     secPatterns.add(ae.getSecurityPattern());
                     if (ae.getSecurityPattern().getType().equals(SecurityPattern.ADVANCED_PATTERN)) {
                         //Type Advanced
@@ -1186,7 +1186,7 @@ public class FullTML2Avatar {
 
                             if (block.getAvatarAttributeWithName(ae.getSecurityPattern().getKey()) != null && block.getAvatarAttributeWithName("encryptedKey_" + ae.getSecurityPattern().getKey()) != null && block.getAvatarAttributeWithName("key_" + ae.getSecurityPattern().getName()) != null) {
                                 block.addMethod(sencrypt);
-                                tran.addAction("encryptedKey_" + ae.getSecurityPattern().getKey() + " = sencrypt(key_" + ae.getSecurityPattern().getKey() + ", key_" + ae.getSecurityPattern().getName() + ")");
+                                tran.addAction("encryptedKey_" + ae.getSecurityPattern().getKey() + " = sencrypt(" + ae.getSecurityPattern().getKey() + ", key_" + ae.getSecurityPattern().getName() + ")");
                             }
                         } else {
                             //Securing data
diff --git a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java
index 682145ce1141c832ba94fb668ac40c0327b251c9..e02dc4cedcfdf99b0878568485adda3d84d886b0 100644
--- a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java
+++ b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java
@@ -60,23 +60,22 @@ public class TML2Avatar {
     private final static Integer channelPrivate = 1;
     private final static Integer channelUnreachable = 2;
     //private AvatarAttribute pKey;
-    public Map<TMLChannel, Integer> channelMap = new HashMap<TMLChannel, Integer>();
-    public Map<TMLTask, AvatarBlock> taskBlockMap = new HashMap<TMLTask, AvatarBlock>();
-    public Map<String, Integer> originDestMap = new HashMap<String, Integer>();
-    public Map<String, Object> stateObjectMap = new HashMap<String, Object>();
-    public Map<TMLTask, List<SecurityPattern>> accessKeys = new HashMap<TMLTask, List<SecurityPattern>>();
-    public ArrayList<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>();
-    public int loopLimit = 1;
-    HashMap<TMLChannel, Set<String>> channelsSecAttributes = new HashMap<TMLChannel, Set<String>>();
-    HashMap<TMLChannel, Set<AvatarPragma>> secChannelMap = new HashMap<TMLChannel, Set<AvatarPragma>>();
-    HashMap<String, List<AvatarAttributeState>> signalAuthOriginMap = new HashMap<String, List<AvatarAttributeState>>();
-    HashMap<String, List<AvatarAttributeState>> signalAuthDestMap = new HashMap<String, List<AvatarAttributeState>>();
-    List<AvatarSignal> signals = new ArrayList<AvatarSignal>();
-    AvatarSpecification avspec;
-    ArrayList<String> attrsToCheck;
-    List<String> allStates;
-    boolean mc = false;
-    boolean security = false;
+    private Map<TMLTask, AvatarBlock> taskBlockMap = new HashMap<TMLTask, AvatarBlock>();
+    private Map<String, Integer> originDestMap = new HashMap<String, Integer>();
+    private Map<String, Object> stateObjectMap = new HashMap<String, Object>();
+    private Map<TMLTask, List<SecurityPattern>> accessKeys = new HashMap<TMLTask, List<SecurityPattern>>();
+    private ArrayList<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>();
+    private int loopLimit = 1;
+    private HashMap<TMLChannel, Set<String>> channelsSecAttributes = new HashMap<TMLChannel, Set<String>>();
+    private HashMap<TMLChannel, Set<AvatarPragma>> secChannelMap = new HashMap<TMLChannel, Set<AvatarPragma>>();
+    private HashMap<String, List<AvatarAttributeState>> signalAuthOriginMap = new HashMap<String, List<AvatarAttributeState>>();
+    private HashMap<String, List<AvatarAttributeState>> signalAuthDestMap = new HashMap<String, List<AvatarAttributeState>>();
+    private List<AvatarSignal> signals = new ArrayList<AvatarSignal>();
+    private AvatarSpecification avspec;
+    private ArrayList<String> attrsToCheck;
+    private List<String> allStates;
+    private boolean mc = false;
+    private boolean security = false;
     private TMLMapping<?> tmlmap;
     private TMLModeling<?> tmlmodel;
     private Set<SecurityPattern> keysPublicBus = new HashSet<SecurityPattern>();
@@ -820,9 +819,9 @@ public class TML2Avatar {
             as.addNext(tran);
             elementList.add(as);
             elementList.add(tran);
-            if (security && ae.getSecurityPattern() != null) {
+            if (security && ae.getSecurityPattern() != null && ae instanceof TMLExecC) {
                 //If encryption
-                if (!((TMLActivityElementWithAction) ae).isDecryptionProcess()) {
+                if (!((TMLExecC) ae).isDecryptionProcess()) {
                     secPatterns.add(ae.getSecurityPattern());
                     if (ae.getSecurityPattern().getType().equals(SecurityPattern.ADVANCED_PATTERN)) {
                         //Type Advanced
@@ -1362,8 +1361,8 @@ public class TML2Avatar {
                             TMLActivityElement nextAe = allNextForAe.get(0);
                             allNextForAe.addAll(nextAe.getNexts());
                             if (security && nextAe.getSecurityPattern() != null) {
-                                if (nextAe instanceof TMLActivityElementWithAction) {
-                                    if (((TMLActivityElementWithAction) nextAe).isDecryptionProcess()) {
+                                if (nextAe instanceof TMLExecC) {
+                                    if (((TMLExecC) nextAe).isDecryptionProcess()) {
                                         if (nextAe.getSecurityPattern().equalSpec(ae.getSecurityPattern())) {
                                             foundDecrytionOp = true;
                                         }
@@ -1509,8 +1508,8 @@ public class TML2Avatar {
                             allPrevOfAe.add(actDiagram.getPrevious(prevAe));
                         }
                         if (security && prevAe.getSecurityPattern() != null) {
-                            if (prevAe instanceof TMLActivityElementWithAction) {
-                                if (!((TMLActivityElementWithAction) prevAe).isDecryptionProcess()) {
+                            if (prevAe instanceof TMLExecC) {
+                                if (!((TMLExecC) prevAe).isDecryptionProcess()) {
                                     if (prevAe.getSecurityPattern().equalSpec(ae.getSecurityPattern())) {
                                         foundEncrytionOp = true;
                                     }