diff --git a/src/main/java/myutil/SortedVector.java b/src/main/java/myutil/SortedVector.java
index 1f60d0a7da0312e5026a38ad2a0b2739d747f6b3..b2d5f34e01802f7874c09972936b84be70c0a450 100755
--- a/src/main/java/myutil/SortedVector.java
+++ b/src/main/java/myutil/SortedVector.java
@@ -49,7 +49,7 @@ package myutil;
 import java.util.Vector;
 
 
-public class SortedVector<T> extends Vector<T>{
+public class SortedVector<T extends Comparable<T>> extends Vector<T>{
     
     /**
 	 * 
@@ -65,9 +65,9 @@ public class SortedVector<T> extends Vector<T>{
     }
     
     public boolean add(T o) {
-        if (o instanceof Comparable<?>) {
+        if (o != null) {
             int i = 0;
-            while((i<size()) && (((Comparable)o).compareTo(elementAt(i)) >= 0)) {
+            while((i<size()) && (o.compareTo(elementAt(i)) >= 0)) {
                 i++;
             }
             add(i, o);
diff --git a/src/main/java/tpndescription/TPN.java b/src/main/java/tpndescription/TPN.java
index c6113215be6a8d0fc55341bb61566ceef0a233bb..7fe17a7e88a0ec98936bfb42a657eca979837c6a 100755
--- a/src/main/java/tpndescription/TPN.java
+++ b/src/main/java/tpndescription/TPN.java
@@ -58,8 +58,8 @@ public class TPN {
     private LinkedList attributes;
     
     public TPN() {
-        places = new LinkedList();
-        transitions = new LinkedList();
+        places = new LinkedList<>();
+        transitions = new LinkedList<>();
     }
     
     public LinkedList<Place> getPlaces() {
diff --git a/src/main/java/translator/GroupOfGates.java b/src/main/java/translator/GroupOfGates.java
index 1247b9b4747cd91b5504c5d9fdab078f06ce0559..d46b674d27ca04fd5c842abbb41d3cbc9c63016b 100755
--- a/src/main/java/translator/GroupOfGates.java
+++ b/src/main/java/translator/GroupOfGates.java
@@ -49,7 +49,7 @@ package translator;
 import myutil.GenericTree;
 import myutil.SortedVector;
 
-public class GroupOfGates extends SortedVector implements Comparable<GroupOfGates>, GenericTree {
+public class GroupOfGates extends SortedVector<TClassGate> implements Comparable<GroupOfGates>, GenericTree {
     /**
 	 * 
 	 */
@@ -68,19 +68,16 @@ public class GroupOfGates extends SortedVector implements Comparable<GroupOfGate
         return masterGate;
     }
     
-    public boolean add(Object o) {
-        if (o instanceof TClassGate) {
-            return (super.add(o));
-        }
-        return false;
+    public boolean add(TClassGate o) {
+        return super.add(o);
     }
     
     public Gate getGateAt(int i) {
-        return ((TClassGate)(elementAt(i))).getGate();
+        return (elementAt(i)).getGate();
     }
     
     public TClass getTClassAt(int i) {
-        return ((TClassGate)(elementAt(i))).getTClass();
+        return (elementAt(i)).getTClass();
     }
     
     
diff --git a/src/main/java/translator/TClassGate.java b/src/main/java/translator/TClassGate.java
index d04360078bcb58febb58e4e3851c50579c2e3a70..1eb7115bbd003dff14af63775bb9ae8def0ca3b3 100755
--- a/src/main/java/translator/TClassGate.java
+++ b/src/main/java/translator/TClassGate.java
@@ -46,7 +46,7 @@ knowledge of the CeCILL license and that you accept its terms.
 package translator;
 
 
-public class TClassGate implements Comparable {
+public class TClassGate implements Comparable<TClassGate> {
     private TClass t;
     private Gate g;
     
@@ -67,13 +67,8 @@ public class TClassGate implements Comparable {
         return t.getName() + "." + g.getName();
     }
     
-    public int compareTo(Object o) {
-        if (!(o instanceof TClassGate)) {
-            return 0;
-        } else {
-            return toString().compareTo(o.toString());
-        }
-        
+    public int compareTo(TClassGate o) {
+        return toString().compareTo(o.toString());
     }
     
 }
diff --git a/src/main/java/translator/TURTLEModeling.java b/src/main/java/translator/TURTLEModeling.java
index 4779aca1432143e15f7ded03d4cc5ed219f79551..68e6c9913e4b20fa39f4df244249308250847332 100755
--- a/src/main/java/translator/TURTLEModeling.java
+++ b/src/main/java/translator/TURTLEModeling.java
@@ -55,15 +55,15 @@ public class TURTLEModeling {
 	private String[] ops = {">", "<", "+", "-", "*", "/", "[", "]", "(", ")", ":", "=", "==", ",", "!", "?", "{", "}"};
     
 	
-    private Vector tclass;
-    private Vector relation;
+    private Vector<TClass> tclass;
+    private Vector<Relation> relation;
 	//private ArrayList<ADComponent> componentsRA; //Components tag with reachability analysis
     //private Vector hlprocess;
     private int classIndex = 0;
     
     public TURTLEModeling() {
-        tclass = new Vector();
-        relation = new Vector();
+        tclass = new Vector<>();
+        relation = new Vector<>();
 		//componentsRA = new ArrayList<ADComponent>();
     }
     
@@ -129,13 +129,13 @@ public class TURTLEModeling {
         if (i >= tclass.size())
             return null;
         else
-            return (TClass)(tclass.elementAt(i));
+            return tclass.elementAt(i);
     }
     
     public TClass getTClassWithName(String s) {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             if (t.getName().equals(s)) {
                 return t;
             }
@@ -146,7 +146,7 @@ public class TURTLEModeling {
 	public TClass findTClass(ADComponent adc) {
 		TClass tmp;
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (tmp.has(adc)) {
                 return tmp;
             }
@@ -157,7 +157,7 @@ public class TURTLEModeling {
 	public void addAllTClassesEndingWith(ArrayList<TClass> tclasses, String end) {
 		TClass tmp;
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
 			if (tmp.getName().endsWith(end)) {
 				tclasses.add(tmp);
 				System.out.println("Adding tclass:" + tmp.getName());
@@ -172,7 +172,7 @@ public class TURTLEModeling {
     public boolean belongsToMe(TClass t) {
         TClass tmp;
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (tmp == t) {
                 return true;
             }
@@ -184,14 +184,14 @@ public class TURTLEModeling {
         if (i > relation.size())
             return null;
         else
-            return (Relation)(relation.elementAt(i));
+            return relation.elementAt(i);
     }
     
     public Relation syncRelationWith(TClass t1, Gate g1) {
 		Relation r;
         
         for(int i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if (r.correspondingGate(g1, t1) != null) {
                 return r;
             }
@@ -203,7 +203,7 @@ public class TURTLEModeling {
         Relation r;
         
         for(int i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if (((t1 == r.t1) && (t2 == r.t2)) || ((t2 == r.t1) && (t1 == r.t2))) {
                 return r;
             }
@@ -214,7 +214,7 @@ public class TURTLEModeling {
     public boolean knownAction(String action) {
         TClass tmp;
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (tmp.getGateByName(action) != null) {
                 return true;
             }
@@ -227,7 +227,7 @@ public class TURTLEModeling {
         int cpt=0;
         
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (tmp.getGateByName(action) != null) {
                 cpt ++;
             }
@@ -243,7 +243,7 @@ public class TURTLEModeling {
         //int cpt=0;
         
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (tmp.getGateByName(action) != null) {
                 return tmp;
             }
@@ -278,7 +278,7 @@ public class TURTLEModeling {
 		Relation r;
         
         for(int i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if (!(r.type < 4)) {
 				return false;
             }
@@ -289,7 +289,7 @@ public class TURTLEModeling {
 	public boolean hasOnlyRegularTClasses(boolean choicesDeterministic, boolean variableAsActions) {
 		TClass tmp;
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if (!isRegularTClass(tmp.getActivityDiagram(), choicesDeterministic, variableAsActions)) {
                 return false;
             }
@@ -364,7 +364,7 @@ public class TURTLEModeling {
         int cpt = 0;
         
         for(int i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if ((t == r.t1) && (r.type == Relation.SEQ)) {
                 cpt ++;
             }
@@ -377,7 +377,7 @@ public class TURTLEModeling {
         int cpt = 0;
         
         for(int i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if ((t == r.t1) && (r.type == Relation.PRE)) {
                 cpt ++;
             }
@@ -395,7 +395,7 @@ public class TURTLEModeling {
         
         // setting lotos name = default name
         for(i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             tmp.setLotosName(tmp.getName());
             
             v = tmp.getParamList();
@@ -407,7 +407,7 @@ public class TURTLEModeling {
         
         
         for(i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             // Tclass name
             name = tmp.getLotosName();
             if (RTLOTOSKeyword.isAKeyword(name)) {
@@ -457,7 +457,7 @@ public class TURTLEModeling {
         
         
         for(i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             
             // TClasses attributes
             v = tmp.getParamList();
@@ -486,14 +486,14 @@ public class TURTLEModeling {
 	}*/
     
     public void makeNameOfHiddenGatesUnic() {
-        Vector v = new Vector();
-        Vector gates;
+        Vector<Gate> v = new Vector<>();
+        Vector<Gate> gates;
         int i, j;
         TClass t;
         Gate g;
         
         for(i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             gates = t.getGateList();
             for(j=0; j<gates.size(); j++) {
                 v.addElement(gates.elementAt(j));
@@ -501,7 +501,7 @@ public class TURTLEModeling {
         }
         
         for(i=0; i<v.size(); i++) {
-            g = (Gate)(v.elementAt(i));
+            g = v.elementAt(i);
             if (!okGateName(g.getLotosName(), g, v)) {
                 g.setLotosName(generateUnicGateName(g, v));
             }
@@ -531,7 +531,7 @@ public class TURTLEModeling {
         TClass tmp;
         
         for(int i=0; i<tclass.size(); i++) {
-            tmp = (TClass)(tclass.elementAt(i));
+            tmp = tclass.elementAt(i);
             if ((tmp != t) && (tmp.getLotosName().equals(name))) {
                 return false;
             }
@@ -846,7 +846,7 @@ public class TURTLEModeling {
         int i, j;
         
         for(i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if (r.type == Relation.INV) {
                 // This is a Invocation relation
                 // Let T1 be the invoker tclass
@@ -870,7 +870,7 @@ public class TURTLEModeling {
         //String name = "unknown";
         
         for(i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             if (r.type == Relation.WAT) {
                 t = r.t1;
                 //watchdog = r.t2;
@@ -885,7 +885,7 @@ public class TURTLEModeling {
     public void translateActionStatesWithMultipleParams() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             t.getActivityDiagram().translateActionStatesWithMultipleParams(t);
         }
     }
@@ -928,7 +928,7 @@ public class TURTLEModeling {
     private void removeUselessParallel() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             //System.out.println("t=" + t.getName());
             removeUselessParallel(t.getActivityDiagram());
         }
@@ -937,7 +937,7 @@ public class TURTLEModeling {
     private void removeUselessJunction() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             //System.out.println("t=" + t.getName());
             removeUselessJunction(t.getActivityDiagram());
         }
@@ -946,7 +946,7 @@ public class TURTLEModeling {
     private void removeUselessSequence() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             //System.out.println("t=" + t.getName());
             removeUselessSequence(t.getActivityDiagram());
         }
@@ -1194,7 +1194,7 @@ public class TURTLEModeling {
 	public void removeUselessVariables(LinkedList<CheckingError> warnings) {
 		 TClass t;
 		 for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             removeUselessVariables(t, warnings);
 		 }
 	}
@@ -1488,7 +1488,7 @@ public class TURTLEModeling {
 	public void removeUselessGates(LinkedList<CheckingError> warnings) {
 		 TClass t;
 		 for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             removeUselessGates(t, warnings);
 		 }
 	}
@@ -1529,7 +1529,7 @@ public class TURTLEModeling {
 		
 		// Checks in relations
 		for(i=0; i<relationNb(); i++) {
-			r = (Relation)(relation.get(i));
+			r = relation.get(i);
 			og = r.correspondingGate(g, t);
 			if (og != null) {
 				usage = checkGateInAD(r.otherTClass(t), og);
@@ -1602,7 +1602,7 @@ public class TURTLEModeling {
         int i;
         
         for(i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             System.out.println("\nTClass " + t.getName());
 			t.printParamsValues();
 			t.printGates();
@@ -1610,7 +1610,7 @@ public class TURTLEModeling {
         }
         
         for(i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             //System.out.println("\nTClass " + t.getName());
             r.print();
         }
@@ -1623,7 +1623,7 @@ public class TURTLEModeling {
         int i;
         
         for(i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             if (t.getName().compareTo(className) ==0) {
                 System.out.println("\nTClass " + t.getName());
                 t.getActivityDiagram().print();
@@ -1639,14 +1639,14 @@ public class TURTLEModeling {
         int i;
         
         for(i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             sb.append("\nTClass " + t.getName()+ "\n");
             t.getActivityDiagram().printToStringBuffer(sb);
         }
         
         sb.append("\n\nRelations:\n");
         for(i=0; i<relation.size(); i++) {
-            r = (Relation)(relation.elementAt(i));
+            r = relation.elementAt(i);
             //System.out.println("\nTClass " + t.getName());
             r.printToStringBuffer(sb);
         }
@@ -1656,7 +1656,7 @@ public class TURTLEModeling {
     public void simplify() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             System.out.println("\nSimplifying 1  t=" + t.getName());
             removeAllUselessComponent(t.getActivityDiagram(), false);
         }
@@ -1665,7 +1665,7 @@ public class TURTLEModeling {
     public void simplify(boolean debug) {
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
 			
             if (debug) {
 				System.out.println("\n********************** Simplifying t=" + t.getName());
@@ -1682,7 +1682,7 @@ public class TURTLEModeling {
     public void simplify(boolean debug, boolean specialChoices) {
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
 			
             if (debug) {
 				System.out.println("\n********************** Simplifying t=" + t.getName());
@@ -1698,7 +1698,7 @@ public class TURTLEModeling {
 	public void countJunctions() {
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
 			System.out.println("\n********************** Counting for t=" + t.getName());
 			System.out.println("***** nbOfjunctions=" + t.getNbOfJunctions());
         }
@@ -1714,7 +1714,7 @@ public class TURTLEModeling {
     public void removeInfiniteLoops() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             //System.out.println("Testing " + t.getName());
             /*if (t.getName().compareTo("StreamDataServ") == 0) {
                 removeInfiniteLoopsAD(t.getActivityDiagram(), true);
@@ -1760,9 +1760,9 @@ public class TURTLEModeling {
         return false;
     }
     
-    public Vector needsUnrolling(ActivityDiagram ad, ADComponent adc) {
+    private Vector<ADComponent> needsUnrolling(ActivityDiagram ad, ADComponent adc) {
         // infinite loop leading to the same choice ?
-        Vector tested = new Vector();
+        Vector<ADComponent> tested = new Vector<>();
         boolean b = infinitePathFromTo(adc, adc, tested);
         if (b) {
             return tested;
@@ -1771,7 +1771,7 @@ public class TURTLEModeling {
         }
     }
     
-    public boolean infinitePathFromTo(ADComponent ad1, ADComponent ad2, Vector tested) {
+    private boolean infinitePathFromTo(ADComponent ad1, ADComponent ad2, Vector<ADComponent> tested) {
         
         tested.add(ad1);
         Vector list = ad1.getAllNext();
@@ -1849,7 +1849,7 @@ public class TURTLEModeling {
         //System.out.println("Substitute to null");
         ad.setAllSubstituteToNull();
         
-        Vector pathOld = new Vector();
+        Vector<ADComponent> pathOld = new Vector<>();
         //Vector adNew = new Vector();
         
         pathOld.add(adc.getNext(0)); // A junction has only one next component
@@ -1909,8 +1909,8 @@ public class TURTLEModeling {
         ad.print();*/
     }
     
-    public void RebuildADFrom(ActivityDiagram ad, Vector path, ADComponent adcToAvoid, boolean debug) {
-        ADComponent adc = (ADComponent)(path.get(path.size()-1));
+    public void RebuildADFrom(ActivityDiagram ad, Vector<ADComponent> path, ADComponent adcToAvoid, boolean debug) {
+        ADComponent adc = path.get(path.size()-1);
         //ADComponent cloned;
         ADComponent adctmp;
         Vector nexts = new Vector();
@@ -1939,7 +1939,7 @@ public class TURTLEModeling {
         }
     }
     
-    public void createAD(Vector path, ADComponent finalAdc, ADComponent adcToAvoid, boolean debug) {
+    public void createAD(Vector<ADComponent> path, ADComponent finalAdc, ADComponent adcToAvoid, boolean debug) {
         int i, j;
         ADComponent adc;
         //Vector nexts;
@@ -1952,7 +1952,7 @@ public class TURTLEModeling {
         // Go though throws path and check whether the component exists or not -> if yes, then goes on
         
         for(i=0; i<path.size()-1; i++) {
-            adc = (ADComponent)(path.elementAt(i));
+            adc = path.elementAt(i);
             if (adc.substitute == null) {
                 // Must create the substitute and link it to the previous one
                 //nexts = adc.getAllNext();
@@ -2003,8 +2003,8 @@ public class TURTLEModeling {
         int index;
         
         for(i=0; i<path.size()-1; i++) {
-            adc1 = (ADComponent)(path.elementAt(i));
-            adc2 = (ADComponent)(path.elementAt(i+1));
+            adc1 = path.elementAt(i);
+            adc2 = path.elementAt(i+1);
             adc3 = adc1.substitute;
             adc4 = adc2.substitute;
             index = adc1.getAllNext().indexOf(adc2);
@@ -2012,7 +2012,7 @@ public class TURTLEModeling {
         }
         
         // last one: finalAdc
-        adc1 = (ADComponent)(path.elementAt(path.size()-2));
+        adc1 = path.elementAt(path.size()-2);
         adc3 = adc1.substitute;
         index = adc1.getAllNext().indexOf(finalAdc);
         //System.out.println("Index:" + index);
@@ -2239,7 +2239,7 @@ public class TURTLEModeling {
     public void removeChoicesLeadingToStop() {
         TClass t;
         for(int i=0; i<tclass.size(); i++) {
-            t = (TClass)(tclass.elementAt(i));
+            t = tclass.elementAt(i);
             //System.out.println("----------------------- Testing choices of " + t.getName());
             removeChoicesLeadingToStopAD(t.getActivityDiagram());
         }
@@ -2287,12 +2287,12 @@ public class TURTLEModeling {
     }
     
     public int getPathAction(ADChoice adch) {
-        Vector list = adch.getAllNext();
-        Vector path = new Vector();
+        Vector<ADComponent> list = adch.getAllNext();
+        Vector<ADComponent> path = new Vector<>();
         ADComponent adc;
         boolean foundAction;
         for (int i=0; i<list.size(); i++) {
-            adc = (ADComponent)(list.elementAt(i));
+            adc = list.elementAt(i);
             foundAction = explorePathAction(adc, path, adch);
             if (foundAction) {
                 return i;
@@ -2301,7 +2301,7 @@ public class TURTLEModeling {
         return -1;
     }
     
-    public boolean explorePathAction(ADComponent adc, Vector path, ADComponent adch) {
+    public boolean explorePathAction(ADComponent adc, Vector<ADComponent> path, ADComponent adch) {
         ADComponent adcbis;
         
         if (adc == null) {
@@ -2325,9 +2325,9 @@ public class TURTLEModeling {
         }
         
         path.add(adc);
-        Vector list = adc.getAllNext();
+        Vector<ADComponent> list = adc.getAllNext();
         for(int i=0; i<list.size(); i++) {
-            adcbis = (ADComponent)(list.elementAt(i));
+            adcbis = list.elementAt(i);
             if (explorePathAction(adcbis, path, adch)) {
                 return true;
             }
@@ -2337,13 +2337,13 @@ public class TURTLEModeling {
     }
     
     public int getPathStop(ADChoice adch) {
-        Vector list = adch.getAllNext();
-        Vector path = new Vector();
+        Vector<ADComponent> list = adch.getAllNext();
+        Vector<ADComponent> path = new Vector<>();
         ADComponent adc;
         boolean foundAction;
         boolean foundStop;
         for (int i=0; i<list.size(); i++) {
-            adc = (ADComponent)(list.elementAt(i));
+            adc = list.elementAt(i);
             foundAction = explorePathAction(adc, path, adch);
             path.removeAllElements();
             foundStop = explorePathStop(adc, path, adch);
@@ -2355,8 +2355,7 @@ public class TURTLEModeling {
         return -1;
     }
     
-    public boolean explorePathStop(ADComponent adc, Vector path, ADComponent adch) {
-        ADComponent adcbis;
+    public boolean explorePathStop(ADComponent adc, Vector<ADComponent> path, ADComponent adch) {
         if (adc == adch) {
             return false;
         }
@@ -2376,9 +2375,9 @@ public class TURTLEModeling {
         
         
         path.add(adc);
-        Vector list = adc.getAllNext();
+        Vector<ADComponent> list = adc.getAllNext();
         for(int i=0; i<list.size(); i++) {
-            adcbis = (ADComponent)(list.elementAt(i));
+            ADComponent adcbis = list.elementAt(i);
             if (explorePathStop(adcbis, path, adch)) {
                 return true;
             }
@@ -2519,7 +2518,7 @@ public class TURTLEModeling {
     }
     
     public boolean canReachSynchroOn(ADParallel adp, Gate g) {
-		LinkedList ll = new LinkedList();
+		LinkedList<ADComponent> ll = new LinkedList<>();
 		for(int i=0; i<adp.getNbNext(); i++) {
 			if (canReachSynchroOn(adp, g, adp.getNext(i), ll)) {
 				return true;
@@ -2528,7 +2527,7 @@ public class TURTLEModeling {
 		return false;
     }
 	
-    public boolean canReachSynchroOn(ADParallel adp, Gate g, ADComponent adc, LinkedList ll) {
+    public boolean canReachSynchroOn(ADParallel adp, Gate g, ADComponent adc, LinkedList<ADComponent> ll) {
 		if (adc == adp) {
 			return true;
 		}
@@ -2561,7 +2560,7 @@ public class TURTLEModeling {
     public void unrollRecursions(int n) {
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-			t = (TClass)(tclass.elementAt(i));
+			t = tclass.elementAt(i);
 			//System.out.println("----------------------- Testing choices of " + t.getName());
 			unrollRecursions(t.getActivityDiagram(), n);
         }
@@ -2591,7 +2590,7 @@ public class TURTLEModeling {
     }
     
     public boolean hasRecursion(ADComponent adc) {
-		LinkedList ll = new LinkedList();
+		LinkedList<ADComponent> ll = new LinkedList<>();
 		for(int i=0; i<adc.getNbNext(); i++) {
 			if (hasRecursion(adc, adc.getNext(i), ll)) {
 				return true;
@@ -2601,7 +2600,7 @@ public class TURTLEModeling {
     }
     
     public int getFirstNextRecursion(ADComponent adc) {
-		LinkedList ll = new LinkedList();
+		LinkedList<ADComponent> ll = new LinkedList<>();
 		for(int i=0; i<adc.getNbNext(); i++) {
 			if (hasRecursion(adc, adc.getNext(i), ll)) {
 				return i;
@@ -2610,7 +2609,7 @@ public class TURTLEModeling {
 		return -1;
     }
     
-    public boolean hasRecursion(ADComponent base, ADComponent current, LinkedList ll) {
+    public boolean hasRecursion(ADComponent base, ADComponent current, LinkedList<ADComponent> ll) {
 		if (base == current) {
 			return true;
 		}
@@ -2629,8 +2628,8 @@ public class TURTLEModeling {
     }
     
     public boolean unroll(ADComponent adc, int n) {
-		LinkedList path = new LinkedList();
-		calculateOneRecursionPath(adc, new LinkedList(), path);
+		LinkedList<ADComponent> path = new LinkedList<>();
+		calculateOneRecursionPath(adc, new LinkedList<ADComponent>(), path);
 		
 		// A path has been built -> clone it n times
 		// Find the ADJunction
@@ -2645,11 +2644,11 @@ public class TURTLEModeling {
 		return true;
     }
     
-    public ADJunction lastADJunction(LinkedList path) {
+    public ADJunction lastADJunction(LinkedList<ADComponent> path) {
 		ADComponent adc;
 		
 		for(int i=path.size()-1; i>-1; i++) {
-			adc = (ADComponent)(path.get(i));
+			adc = path.get(i);
 			if (adc instanceof ADJunction) {
 				return (ADJunction)adc;
 			}
@@ -2657,17 +2656,16 @@ public class TURTLEModeling {
 		return null;
     }
     
-    public void calculateOneRecursionPath(ADComponent adc, LinkedList explored, LinkedList path) {
+    private void calculateOneRecursionPath(ADComponent adc, LinkedList<ADComponent> explored, LinkedList<ADComponent> path) {
 		explored.add(adc);
 		for(int i=0; i<adc.getNbNext(); i++) {
 			if (calculateOneRecursionPath(adc, adc.getNext(i), explored, path)) {
 				return;
 			}
 		}
-		return;
     }
     
-    public boolean calculateOneRecursionPath(ADComponent base, ADComponent current, LinkedList explored, LinkedList path) {
+    private boolean calculateOneRecursionPath(ADComponent base, ADComponent current, LinkedList<ADComponent> explored, LinkedList<ADComponent> path) {
 		if (current == base) {
 			path.add(current);
 			return true;
@@ -2692,7 +2690,7 @@ public class TURTLEModeling {
 		System.out.println("Unmerging choices: algorithm");
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-			t = (TClass)(tclass.elementAt(i));
+			t = tclass.elementAt(i);
 			unmergeChoices(t.getActivityDiagram());
         }
 	}
@@ -2741,7 +2739,7 @@ public class TURTLEModeling {
 		System.out.println("Merging choices: algorithm");
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-			t = (TClass)(tclass.elementAt(i));
+			t = tclass.elementAt(i);
 			mergeChoices(t.getActivityDiagram());
         }
 		System.out.println("End merging choices: algorithm");
@@ -2817,7 +2815,7 @@ public class TURTLEModeling {
 		//Second option: save data with synchro, and load data with synchro
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-			t = (TClass)(tclass.elementAt(i));
+			t = tclass.elementAt(i);
 			makeSequenceWithDataSave(t);
         }
 	}
@@ -2835,7 +2833,7 @@ public class TURTLEModeling {
 			return;
 		}	
 		
-		Vector v = t.getParamList();
+		Vector<Param> v = t.getParamList();
 		
 		// No parameter to save?
 		if ((v == null) || (v.size() == 0)) {
@@ -2849,7 +2847,7 @@ public class TURTLEModeling {
 		int i;
 		
 		for(i=0; i<v.size(); i++) {
-			p=(Param)(v.get(i));
+			p=v.get(i);
 			list1+="!" + p.getName();
 			list2+="?" + p.getName() + ":nat";
 		}
@@ -2864,7 +2862,7 @@ public class TURTLEModeling {
 		adp.setValueGate("[putseq__, getseq__]");
 		adp.setNewNext(ads.getAllNext());
 		ad.add(adp);
-		ads.setNewNext(new Vector());
+		ads.setNewNext(new Vector<ADComponent>());
 		ads.addNext(adp);
 		
 		
@@ -2893,14 +2891,14 @@ public class TURTLEModeling {
 		ADComponent adc, adc1;
 		ADActionStateWithGate adsg;
 		for(i=0; i<ad.size(); i++) {
-			adc = (ADComponent)(ad.get(i));
+			adc = ad.get(i);
 			if (adc instanceof ADStop) {
 				adc1 = ad.getFirstComponentLeadingTo(adc);
 				if (adc1 != null ){
 					adsg = new ADActionStateWithGate(gput);
 					adsg.setActionValue(list1);
 					ad.add(adsg);
-					adc1.setNewNext(new Vector());
+					adc1.setNewNext(new Vector<ADComponent>());
 					adc1.addNext(adsg);
 					adsg.addNext(adc);
 				}
@@ -2910,19 +2908,19 @@ public class TURTLEModeling {
 		// All next element of sequences must start with an action state on get
 		int j;
 		for(i=0; i<ad.size(); i++) {
-			adc = (ADComponent)(ad.get(i));
+			adc = ad.get(i);
 			if (adc instanceof ADSequence) {
-				v = new Vector();
-				v.add(adc.getNext(0));
+				Vector<ADComponent> vad = new Vector<>();
+				vad.add(adc.getNext(0));
 				for(j=1; j<adc.getNbNext(); j++) {
 					adc1 = adc.getNext(j);
 					adsg = new ADActionStateWithGate(gget);
 					adsg.setActionValue(list2);
 					ad.add(adsg);
 					adsg.addNext(adc1);
-					v.add(adsg);
+					vad.add(adsg);
 				}
-				adc.setNewNext(v);
+				adc.setNewNext(vad);
 			}
 		}
 	}
@@ -2932,7 +2930,7 @@ public class TURTLEModeling {
 		//Second option: save data with synchro, and load data with synchro
 		TClass t;
         for(int i=0; i<tclass.size(); i++) {
-			t = (TClass)(tclass.elementAt(i));
+			t = tclass.elementAt(i);
 			removeSequencesDataSave(t.getActivityDiagram());
         }
 	}
diff --git a/src/main/java/ui/interactivesimulation/JPanelSetVariables.java b/src/main/java/ui/interactivesimulation/JPanelSetVariables.java
index 2d012ad6c350f135d16f6a29be63b8d00b27dc37..1f689d0b836f944c78c0d5290d1b666923df3412 100755
--- a/src/main/java/ui/interactivesimulation/JPanelSetVariables.java
+++ b/src/main/java/ui/interactivesimulation/JPanelSetVariables.java
@@ -61,8 +61,8 @@ public	class JPanelSetVariables extends JPanel implements ActionListener  {
 	
  
 	
-	private JComboBox tasks;
-	private JComboBox variables;
+	private JComboBox<String> tasks;
+	private JComboBox<String> variables;
 	private JTextField currentValue, newValue;
 	private JButton setButton;
 	
@@ -101,18 +101,18 @@ public	class JPanelSetVariables extends JPanel implements ActionListener  {
 		add(new JLabel(" "), c2);
 		
 		if (taskIDs == null) {
-			tasks = new JComboBox();
+			tasks = new JComboBox<>();
 		} else {
-			tasks = new JComboBox(taskIDs);
+			tasks = new JComboBox<>(taskIDs);
 			tasks.addActionListener(this);
 		}
 		add(tasks, c2);
 		
 		if ((taskIDs == null) || (taskIDs.length == 0)) {
-			variables = new JComboBox();
+			variables = new JComboBox<>();
 		} else {
 			variableIDs = jfis.makeVariableIDs(0);
-			variables = new JComboBox(variableIDs);
+			variables = new JComboBox<>(variableIDs);
 			variables.addActionListener(this);
 		}
 		add(variables, c2);
diff --git a/src/main/java/ui/window/JDialogAvatarLibraryFunction.java b/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
index 4b918c7e2b70db583fbec994c90e10d378db9120..9783e8ba7255d4ed37cd088d5ece7dcb7cec5bad 100755
--- a/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
+++ b/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
@@ -51,7 +51,9 @@ import javax.swing.event.ListSelectionListener;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedList;
 
 /**
@@ -74,8 +76,8 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
     private JButton modifyButtons[];
     private JButton upButtons[];
     private JButton downButtons[];
-    private JList<Object> listAttribute[];
-    private LinkedList<Object> attributes[];
+    private HashMap<Integer,JList<Object>> listAttribute;
+    private ArrayList<LinkedList<Object>> attributes;
 
     // Parameters Tab
     private JComboBox<String> parametersAccessBox;
@@ -114,28 +116,33 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         this.modifyButtons = new JButton [5];
         this.upButtons = new JButton [5];
         this.downButtons = new JButton [5];
-        this.listAttribute = new JList [5];
-        this.attributes = new LinkedList [5];
+        this.listAttribute = new HashMap<>();
+        this.attributes = new ArrayList<>();
 
-        this.attributes[0] = new LinkedList ();
+        LinkedList<Object> l = new LinkedList<> ();
         for (TAttribute attr: this.bdElement.getParameters ())
-            this.attributes[0].add (attr.makeClone ());
+            l.add (attr.makeClone ());
+        this.attributes.add(l);
 
-        this.attributes[1] = new LinkedList ();
+        l = new LinkedList<> ();
         for (AvatarSignal signal: this.bdElement.getSignals ())
-            this.attributes[1].add (signal.makeClone ());
+            l.add (signal.makeClone ());
+        this.attributes.add(l);
 
-        this.attributes[2] = new LinkedList ();
+        l = new LinkedList<> ();
         for (TAttribute attr: this.bdElement.getReturnAttributes ())
-            this.attributes[2].add (attr.makeClone ());
+            l.add (attr.makeClone ());
+        this.attributes.add(l);
 
-        this.attributes[3] = new LinkedList ();
+        l = new LinkedList<> ();
         for (TAttribute attr: this.bdElement.getAttributes ())
-            this.attributes[3].add (attr.makeClone ());
+            l.add (attr.makeClone ());
+        this.attributes.add(l);
 
-        this.attributes[4] = new LinkedList ();
+        l = new LinkedList<> ();
         for (AvatarMethod meth: this.bdElement.getMethods ())
-            this.attributes[4].add (meth.makeClone ());
+            l.add (meth.makeClone ());
+        this.attributes.add(l);
 
         this.initComponents ();
 
@@ -232,10 +239,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         panelEast.setPreferredSize (new Dimension (300, 450));
 
         //      first line east panel
-        this.listAttribute[tabIndex] = new JList <Object> (this.attributes[tabIndex].toArray ());
-        this.listAttribute[tabIndex].setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        this.listAttribute[tabIndex].addListSelectionListener(this);
-        JScrollPane scrollPane = new JScrollPane(this.listAttribute[tabIndex]);
+        this.listAttribute.put(tabIndex, new JList <> (this.attributes.get(tabIndex).toArray ()));
+        this.listAttribute.get(tabIndex).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        this.listAttribute.get(tabIndex).addListSelectionListener(this);
+        JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(tabIndex));
         scrollPane.setSize(300, 250);
         gridConstraints = new GridBagConstraints();
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
@@ -352,10 +359,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         panelEast.setPreferredSize(new Dimension(300, 250));
 
         //      first line east panel
-        this.listAttribute[1] = new JList<Object> (this.attributes[1].toArray ());
-        this.listAttribute[1].setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        this.listAttribute[1].addListSelectionListener(this);
-        JScrollPane scrollPane = new JScrollPane(listAttribute[1]);
+        this.listAttribute.put(1, new JList<> (this.attributes.get(1).toArray ()));
+        this.listAttribute.get(1).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        this.listAttribute.get(1).addListSelectionListener(this);
+        JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(1));
         scrollPane.setSize(300, 250);
         gridConstraints = new GridBagConstraints();
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
@@ -487,10 +494,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         panelEast.setPreferredSize(new Dimension(300, 250));
 
         //      first line east panel
-        this.listAttribute[4] = new JList<Object> (this.attributes[4].toArray ());
-        this.listAttribute[4].setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        this.listAttribute[4].addListSelectionListener(this);
-        JScrollPane scrollPane = new JScrollPane(listAttribute[4]);
+        this.listAttribute.put(4, new JList<> (this.attributes.get(4).toArray ()));
+        this.listAttribute.get(4).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        this.listAttribute.get(4).addListSelectionListener(this);
+        JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(4));
         scrollPane.setSize(300, 250);
         gridConstraints = new GridBagConstraints();
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
@@ -634,19 +641,19 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
     
     private void save () {
         this.bdElement.resetParameters ();
-        for (Object o: this.attributes[0])
+        for (Object o: this.attributes.get(0))
             this.bdElement.addParameter ((TAttribute) o);
         this.bdElement.resetSignals ();
-        for (Object o: this.attributes[1])
+        for (Object o: this.attributes.get(1))
             this.bdElement.addSignal ((AvatarSignal) o);
         this.bdElement.resetReturnAttributes ();
-        for (Object o: this.attributes[2])
+        for (Object o: this.attributes.get(2))
             this.bdElement.addReturnAttribute ((TAttribute) o);
         this.bdElement.resetAttributes ();
-        for (Object o: this.attributes[3])
+        for (Object o: this.attributes.get(3))
             this.bdElement.addAttribute ((TAttribute) o);
         this.bdElement.resetMethods ();
-        for (Object o: this.attributes[4])
+        for (Object o: this.attributes.get(4))
             this.bdElement.addMethod ((AvatarMethod) o);
     }
 
@@ -740,15 +747,15 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute[tabIndex].getSelectedIndex ();
-            old = this.attributes[tabIndex].remove (index);
+            index = this.listAttribute.get(tabIndex).getSelectedIndex ();
+            old = this.attributes.get(tabIndex).remove (index);
         } else
-            index = this.attributes[tabIndex].size ();
+            index = this.attributes.get(tabIndex).size ();
 
         //checks whether an attribute with this identifier already belongs to the list
-        if (this.attributes[0].contains (a) || this.attributes[2].contains (a) || this.attributes[3].contains (a)) {
+        if (this.attributes.get(0).contains (a) || this.attributes.get(2).contains (a) || this.attributes.get(3).contains (a)) {
             if (modify)
-                this.attributes[tabIndex].add (index, old);
+                this.attributes.get(tabIndex).add (index, old);
             JOptionPane.showMessageDialog (this,
                                           "Bad Identifier: another attribute or parameter already has the same name.",
                                           "Error",
@@ -757,10 +764,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
             return;
         }
 
-        this.attributes[tabIndex].add (index, a);
-        this.listAttribute[tabIndex].setListData (this.attributes[tabIndex].toArray ());
-        this.listAttribute[tabIndex].setSelectedIndex(index);
-        this.listAttribute[tabIndex].requestFocus ();
+        this.attributes.get(tabIndex).add (index, a);
+        this.listAttribute.get(tabIndex).setListData (this.attributes.get(tabIndex).toArray ());
+        this.listAttribute.get(tabIndex).setSelectedIndex(index);
+        this.listAttribute.get(tabIndex).requestFocus ();
     }
 
     private void addMethod (boolean modify) {
@@ -786,15 +793,15 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute[4].getSelectedIndex ();
-            old = this.attributes[4].remove (index);
+            index = this.listAttribute.get(4).getSelectedIndex ();
+            old = this.attributes.get(4).remove (index);
         } else
-            index = this.attributes[4].size ();
+            index = this.attributes.get(4).size ();
 
         // Checks whether the same method already belongs to the list
-        if (this.attributes[4].contains (am)) {
+        if (this.attributes.get(4).contains (am)) {
             if (modify)
-                this.attributes[4].add (index, old);
+                this.attributes.get(4).add (index, old);
             JOptionPane.showMessageDialog (this,
                                           "This method already exists",
                                           "Error",
@@ -803,10 +810,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
             return;
         }
 
-        this.attributes[4].add (index, am);
-        this.listAttribute[4].setListData (this.attributes[4].toArray ());
-        this.listAttribute[4].setSelectedIndex(index);
-        this.listAttribute[4].requestFocus ();
+        this.attributes.get(4).add (index, am);
+        this.listAttribute.get(4).setListData (this.attributes.get(4).toArray ());
+        this.listAttribute.get(4).setSelectedIndex(index);
+        this.listAttribute.get(4).requestFocus ();
     }
 
     private void addSignal (boolean modify) {
@@ -830,16 +837,16 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute[1].getSelectedIndex ();
-            old = this.attributes[1].remove (index);
+            index = this.listAttribute.get(1).getSelectedIndex ();
+            old = this.attributes.get(1).remove (index);
         } else
-            index = this.attributes[1].size ();
+            index = this.attributes.get(1).size ();
 
 
         // Checks whether the same signal already belongs to the list
-        if (this.attributes[1].contains (as)) {
+        if (this.attributes.get(1).contains (as)) {
             if (modify)
-                this.attributes[1].add (index, old);
+                this.attributes.get(1).add (index, old);
             JOptionPane.showMessageDialog (this,
                                           "This signal already exists",
                                           "Error",
@@ -848,10 +855,10 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
             return;
         }
 
-        this.attributes[1].add (index, as);
-        this.listAttribute[1].setListData (this.attributes[1].toArray ());
-        this.listAttribute[1].setSelectedIndex(index);
-        this.listAttribute[1].requestFocus ();
+        this.attributes.get(1).add (index, as);
+        this.listAttribute.get(1).setListData (this.attributes.get(1).toArray ());
+        this.listAttribute.get(1).setSelectedIndex(index);
+        this.listAttribute.get(1).requestFocus ();
     }
 
     private void handleModify () {
@@ -879,21 +886,21 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
 
     private void handleUp () {
         int selectedTab = this.tabbedPane.getSelectedIndex ();
-        int i = this.listAttribute[selectedTab].getSelectedIndex();
+        int i = this.listAttribute.get(selectedTab).getSelectedIndex();
         if (i != -1 && i != 0) {
-            Collections.swap (this.attributes[selectedTab], i, i-1);
-            this.listAttribute[selectedTab].setListData(this.attributes[selectedTab].toArray ());
-            this.listAttribute[selectedTab].setSelectedIndex(i-1);
+            Collections.swap (this.attributes.get(selectedTab), i, i-1);
+            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray ());
+            this.listAttribute.get(selectedTab).setSelectedIndex(i-1);
         }
     }
 
     private void handleDown () {
         int selectedTab = this.tabbedPane.getSelectedIndex ();
-        int i = this.listAttribute[selectedTab].getSelectedIndex();
-        if (i != -1 && i != this.attributes[selectedTab].size() - 1) {
-            Collections.swap (this.attributes[selectedTab], i, i+1);
-            this.listAttribute[selectedTab].setListData(this.attributes[selectedTab].toArray ());
-            this.listAttribute[selectedTab].setSelectedIndex(i+1);
+        int i = this.listAttribute.get(selectedTab).getSelectedIndex();
+        if (i != -1 && i != this.attributes.get(selectedTab).size() - 1) {
+            Collections.swap (this.attributes.get(selectedTab), i, i+1);
+            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray ());
+            this.listAttribute.get(selectedTab).setSelectedIndex(i+1);
         }
     }
 
@@ -921,44 +928,44 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
     }
 
     private void removeAttribute (int tabIndex) {
-        int i = this.listAttribute[tabIndex].getSelectedIndex ();
+        int i = this.listAttribute.get(tabIndex).getSelectedIndex ();
         if (i != -1) {
-            ((TAttribute) this.attributes[tabIndex].get (i)).setAccess (-1);
-            this.attributes[tabIndex].remove (i);
-            this.listAttribute[tabIndex].setListData (this.attributes[tabIndex].toArray ());
+            ((TAttribute) this.attributes.get(tabIndex).get (i)).setAccess (-1);
+            this.attributes.get(tabIndex).remove (i);
+            this.listAttribute.get(tabIndex).setListData (this.attributes.get(tabIndex).toArray ());
         }
     }
 
     private void removeSignal () {
-        int i = this.listAttribute[1].getSelectedIndex ();
+        int i = this.listAttribute.get(1).getSelectedIndex ();
         if (i != -1) {
-            this.attributes[1].remove (i);
-            this.listAttribute[1].setListData(this.attributes[1].toArray ());
+            this.attributes.get(1).remove (i);
+            this.listAttribute.get(1).setListData(this.attributes.get(1).toArray ());
         }
     }
 
     private void removeMethod () {
-        int i = this.listAttribute[4].getSelectedIndex();
+        int i = this.listAttribute.get(4).getSelectedIndex();
         if (i!= -1) {
-            this.attributes[4].remove (i);
-            this.listAttribute[4].setListData (this.attributes[4].toArray ());
+            this.attributes.get(4).remove (i);
+            this.listAttribute.get(4).setListData (this.attributes.get(4).toArray ());
         }
     }
 
     public void valueChanged (ListSelectionEvent e) {
         int selectedTab = this.tabbedPane.getSelectedIndex ();
-        int i = this.listAttribute[selectedTab].getSelectedIndex() ;
+        int i = this.listAttribute.get(selectedTab).getSelectedIndex() ;
 
         this.removeButtons[selectedTab].setEnabled(i != -1);
         this.modifyButtons[selectedTab].setEnabled(i != -1);
         this.upButtons[selectedTab].setEnabled(i > 0);
-        this.downButtons[selectedTab].setEnabled(i != -1 && i < this.attributes[selectedTab].size ()-1);
+        this.downButtons[selectedTab].setEnabled(i != -1 && i < this.attributes.get(selectedTab).size ()-1);
 
         if (selectedTab == 1) { // Signals
             if (i == -1)
                 this.signalText.setText ("");
             else {
-                AvatarSignal as = (AvatarSignal) (this.attributes[1].get (i));
+                AvatarSignal as = (AvatarSignal) (this.attributes.get(1).get (i));
                 this.signalText.setText (as.toBasicString());
                 this.signalInOutBox.setSelectedIndex (as.getInOut());
             }
@@ -966,7 +973,7 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
             if (i == -1)
                 this.methodText.setText ("");
             else {
-                AvatarMethod am = (AvatarMethod) (this.attributes[4].get (i));
+                AvatarMethod am = (AvatarMethod) (this.attributes.get(4).get (i));
                 this.methodText.setText (am.toString());
             }
         } else { // Attributes
@@ -996,7 +1003,7 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements
                 accessBox.setSelectedIndex(0);
                 typeBox.setSelectedIndex(0);
             } else {
-                TAttribute a = (TAttribute) (this.attributes[selectedTab].get (i));
+                TAttribute a = (TAttribute) (this.attributes.get(selectedTab).get (i));
                 textField.setText (a.getId ());
                 initialValue.setText(a.getInitialValue());
                 this.select (accessBox, a.getStringAccess(a.getAccess()));