diff --git a/src/main/java/tmltranslator/TMLMapping.java b/src/main/java/tmltranslator/TMLMapping.java
index 3431c7348f09f93814b833d0f26dc718d00c15c1..9ed708160bb39b0a605a2b3c3bd854141357a497 100755
--- a/src/main/java/tmltranslator/TMLMapping.java
+++ b/src/main/java/tmltranslator/TMLMapping.java
@@ -598,7 +598,7 @@ public class TMLMapping<E> {
         return (mappedtasks.contains(_task));
     }
 
-    public HwNode getHwNodeOf(TMLTask _task) {
+    public HwExecutionNode getHwNodeOf(TMLTask _task) {
         int index = mappedtasks.indexOf(_task);
         if (index == -1) {
             return null;
@@ -830,7 +830,7 @@ public class TMLMapping<E> {
                     if (chan != null) {
                         TMLTask origin = chan.getOriginTask();
                         if ((origin != null) && (isTaskMapped(origin))) {
-                            HwExecutionNode node = (HwExecutionNode) (getHwNodeOf(origin));
+                            HwExecutionNode node =  getHwNodeOf(origin);
                             if (node != null) {
                                 TraceManager.addDev("\n\nMapping fork task " + task.getName() + " to " + node.getName());
                                 addTaskToHwExecutionNode(task, node);
@@ -842,7 +842,7 @@ public class TMLMapping<E> {
                         if (evt != null) {
                             TMLTask origin = evt.getOriginTask();
                             if ((origin != null) && (isTaskMapped(origin))) {
-                                HwExecutionNode node = (HwExecutionNode) (getHwNodeOf(origin));
+                                HwExecutionNode node = getHwNodeOf(origin);
                                 if (node != null) {
                                     TraceManager.addDev("\n\nMapping fork task " + task.getName() + " to " + node.getName());
                                     addTaskToHwExecutionNode(task, node);
@@ -864,7 +864,7 @@ public class TMLMapping<E> {
                     if (chan != null) {
                         TMLTask destination = chan.getDestinationTask();
                         if ((destination != null) && (isTaskMapped(destination))) {
-                            HwExecutionNode node = (HwExecutionNode) (getHwNodeOf(destination));
+                            HwExecutionNode node = getHwNodeOf(destination);
                             if (node != null) {
                                 TraceManager.addDev("\n\nMapping join task " + task.getName() + " to " + node.getName());
                                 addTaskToHwExecutionNode(task, node);
diff --git a/src/main/java/tmltranslator/toavatar/TML2Avatar.java b/src/main/java/tmltranslator/toavatar/TML2Avatar.java
index 707d11a76ac404d6717930abca8780dad0f55031..bec72bbe3e739c4d2bce1807947c7f2251549816 100644
--- a/src/main/java/tmltranslator/toavatar/TML2Avatar.java
+++ b/src/main/java/tmltranslator/toavatar/TML2Avatar.java
@@ -108,7 +108,7 @@ public class TML2Avatar {
             List<SecurityPattern> keys = new ArrayList<SecurityPattern>();
             accessKeys.put(t1, keys);
 
-            HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(t1);
+            HwExecutionNode node1 = tmlmap.getHwNodeOf(t1);
             //Try to find memory using only private buses from origin
             List<HwNode> toVisit = new ArrayList<HwNode>();
             //List<HwNode> toMemory = new ArrayList<HwNode>();
@@ -148,7 +148,7 @@ public class TML2Avatar {
 
 
             for (TMLTask t2 : tmlmodel.getTasks()) {
-                HwExecutionNode node2 = (HwExecutionNode) tmlmap.getHwNodeOf(t2);
+                HwExecutionNode node2 =  tmlmap.getHwNodeOf(t2);
                 if (!memory) {
                     //There is no path to a private memory
                     originDestMap.put(t1.getName() + "__" + t2.getName(), channelPublic);
@@ -235,7 +235,7 @@ public class TML2Avatar {
 					a=channel.getOriginTasks().get(0);
 					destinations.addAll(channel.getDestinationTasks());
 				}  
-				HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(a);
+				HwExecutionNode node1 = tmlmap.getHwNodeOf(a);
 				for (TMLTask t: destinations){
 					//List<HwBus> buses = new ArrayList<HwBus>();
 					HwNode node2 = tmlmap.getHwNodeOf(t);
@@ -1514,8 +1514,8 @@ public class TML2Avatar {
         	TMLTask task = chan.getOriginTask();
         	
         	TMLTask task2 = chan.getDestinationTask();
-        	HwExecutionNode node = (HwExecutionNode) tmlmap.getHwNodeOf(task);
-        	HwExecutionNode node2 = (HwExecutionNode) tmlmap.getHwNodeOf(task2);
+        	HwExecutionNode node =  tmlmap.getHwNodeOf(task);
+        	HwExecutionNode node2 = tmlmap.getHwNodeOf(task2);
         	if (node==null){
         		tmlmap.addTaskToHwExecutionNode(task, node2);
         	}
diff --git a/src/main/java/tmltranslator/tonetwork/TMAP2Network.java b/src/main/java/tmltranslator/tonetwork/TMAP2Network.java
index 4094890c29243faa50b4c1fc415af309dbb96f84..5ae2da05d810ee8c2687a8fc463c741444f2c68f 100644
--- a/src/main/java/tmltranslator/tonetwork/TMAP2Network.java
+++ b/src/main/java/tmltranslator/tonetwork/TMAP2Network.java
@@ -289,7 +289,7 @@ public class TMAP2Network<E>  {
             for(j=0; j<nocSize; j++) {
                 // We must find the number of apps connected on this router
                 TranslatedRouter tr = new TranslatedRouter<>(this, tmlmapping, noc, channelsCommunicatingViaNoc,
-                        nbOfVCs, i, j);
+                        nbOfVCs, i, j, (HwExecutionNode)(tmla.getHwNodeByName(noc.getHwExecutionNode(i, j))));
                 routers[i][j] = tr;
             }
         }
diff --git a/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java b/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java
index 764e6fbdcd0cc36e045db0886560521feaf44a06..9cebc108f200e3587dee40811787eb9fbc4d2de4 100644
--- a/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java
+++ b/src/main/java/tmltranslator/tonetwork/TranslatedRouter.java
@@ -60,15 +60,14 @@ public class TranslatedRouter<E> {
     private final int CHANNEL_SIZE = 4;
     private final int CHANNEL_MAX = 8;
 
-    private int nbOfVCs, xPos, yPos, nbOfApps;
+    private int nbOfVCs, xPos, yPos;
+    private HwExecutionNode myHwExecutionNode;
 
     private TMAP2Network<?> main;
 
     private HwNoC noc;
     private List<TMLChannel> channelsViaNoc;
 
-    private Vector<TMLEvent> pktins;
-    private Vector<TMLTask> dispatchers;
 
     private TMLMapping<?> tmlmap;
 
@@ -104,10 +103,15 @@ public class TranslatedRouter<E> {
     private TaskNetworkInterfaceOUT tniOut;
     private FakeTaskOut fto;
 
+
+    // Connection channels and events
+    private HashMap<TMLChannel, TMLEvent> mapOfAllOutputChannels;
+
     // Hw
     HwExecutionNode node;
 
-    public TranslatedRouter(TMAP2Network<?> main, TMLMapping<?> tmlmap, HwNoC noc, List<TMLChannel> channelsViaNoc, int nbOfVCs, int xPos, int yPos) {
+    public TranslatedRouter(TMAP2Network<?> main, TMLMapping<?> tmlmap, HwNoC noc, List<TMLChannel> channelsViaNoc,
+                            int nbOfVCs, int xPos, int yPos, HwExecutionNode myHwExecutionNode) {
         this.main = main;
         this.nbOfVCs = nbOfVCs;
         this.noc = noc;
@@ -115,6 +119,7 @@ public class TranslatedRouter<E> {
         this.xPos = xPos;
         this.yPos = yPos;
         this.tmlmap = tmlmap;
+        this.myHwExecutionNode = myHwExecutionNode;
 
         playingTheRoleOfPrevious = new Link[NB_OF_PORTS];
         playingTheRoleOfNext = new Link[NB_OF_PORTS];
@@ -197,16 +202,18 @@ public class TranslatedRouter<E> {
 
         // We can create the MUX task: one mux task for each VC
         muxTasks = new Vector<>();
+        mapOfAllOutputChannels = new HashMap<>();
         for (i = 0; i < nbOfVCs; i++) {
             // Now that we know all channels, we can generate the MUX tasks
             // We need one event par outputChannel
-            HashMap<TMLChannel, TMLEvent> mapOfOutputChannels = new HashMap<>();
+            //HashMap<TMLChannel, TMLEvent> mapOfOutputChannels = new HashMap<>();
             Vector<TMLEvent> inputEventsOfMUX = new Vector<>();
             for (TMLChannel chan : outputChannels) {
                 if (chan.getVC() == i) {
                     TMLEvent outputEventOfMux = new TMLEvent("EventMUXof" + chan.getName(), null, 8,
                             true);
-                    mapOfOutputChannels.put(chan, outputEventOfMux);
+                    //mapOfOutputChannels.put(chan, outputEventOfMux);
+                    mapOfAllOutputChannels.put(chan, outputEventOfMux);
                     inputEventsOfMUX.add(outputEventOfMux);
                     tmlm.addEvent(outputEventOfMux);
                 }
@@ -222,11 +229,6 @@ public class TranslatedRouter<E> {
             muxTask.generate(inputEventsOfMUX, eventForMUX_and_NI_IN);
             muxTasks.add(muxTask);
             allTasks.add(muxTask);
-
-            // We now need to modify the corresponding input tasks
-            // The channel is modified to NBRNBW
-            // Once the sample has been sent, the outputEventOfMux is sent
-
         }
 
 
@@ -588,8 +590,8 @@ public class TranslatedRouter<E> {
     }
 
 
-    // DANGER: also make th emapping of channels
-    // ALSO: initial, last tasks
+    // DANGER: also make the mapping of channels
+    // ALSO: initial, last tasks: connections
     public void makeHwArchitectureAndMapping(HwExecutionNode execNode, HwBus busToInternalDomain) {
         TMLArchitecture tmla = tmlmap.getTMLArchitecture();
 
@@ -619,7 +621,6 @@ public class TranslatedRouter<E> {
             tmla.addHwNode(bus);
 
             tmla.makeHwLink(bus, mainBridge);
-
             tmla.makeHwLink(busNIIN, cpu);
         }
 
@@ -631,6 +632,7 @@ public class TranslatedRouter<E> {
 
         HwMemory memNIIN = new HwMemory("MemNetworkiInterfaceIN" + getPositionNaming());
         tmla.addHwNode(memNIIN);
+        tmlmap.addCommToHwCommNode(playingTheRoleOfPrevious[NB_OF_PORTS-1].chOutToIN, memNIIN);
 
         HwBridge bridgeNIIN = new HwBridge("BridgeNetworkiInterfaceIN" + getPositionNaming());
 
@@ -666,6 +668,7 @@ public class TranslatedRouter<E> {
                     tmlmap.addTaskToHwExecutionNode(dispatchInVCs[portNb][i], cpuINVC);
                     HwMemory memINVC = new HwMemory("memINVC" + portNb + "_" + i+ getPositionNaming());
                     tmla.addHwNode(memINVC);
+                    tmlmap.addCommToHwCommNode(pktInChsVCs[portNb][i], memINVC);
                     HwBus busINVC = new HwBus("busINVC" + portNb + "_" + i + getPositionNaming());
                     tmla.addHwNode(busINVC);
                     tmla.makeHwLink(busINVC, cpuINVC);
@@ -693,7 +696,7 @@ public class TranslatedRouter<E> {
                 } else {
                     // internal
                     outForExit = cpuOUT;
-                    HwBus busInternalOUT = new HwBus("BusInternalOUTternal" + getPositionNaming());
+                    HwBus busInternalOUT = new HwBus("BusInternalOUT" + getPositionNaming());
                     tmla.addHwNode((busInternalOUT));
                     tmla.makeHwLink(busInternalOUT, bridgeNIOUT);
                     tmla.makeHwLink(busInternalOUT, cpuOUT);
@@ -744,6 +747,26 @@ public class TranslatedRouter<E> {
         tmlmap.addTaskToHwExecutionNode(fto, node);
 
 
+        // We now need to modify the corresponding input tasks
+        // The channel is modified to NBRNBW
+        // Once the sample has been sent, the outputEventOfMux is sent
+        // It is mapped to the HW node mem
+
+        // For all channels whose origin task is mapped on the CPU of the router
+
+
+        for(TMLChannel ch: tmlmap.getTMLModeling().getChannels()) {
+            TMLTask t = ch.getOriginTask();
+            HwExecutionNode mappedOn = tmlmap.getHwNodeOf(t);
+            if (mappedOn == myHwExecutionNode) {
+                TraceManager.addDev("Found HwNode of task " + t.getTaskName() + " for channel " + ch.getName());
+                // We must rework the channel of the task.
+            }
+        }
+
+
+
+
     }
 
 }
diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java
index d999af96939a23b4ab03d75e9613795a63af80c2..5cf5b65b28b2563d1e59034af5bf1d244221be55 100644
--- a/src/main/java/ui/GTURTLEModeling.java
+++ b/src/main/java/ui/GTURTLEModeling.java
@@ -803,8 +803,8 @@ public class GTURTLEModeling {
         //Check if a path between two tasks uses firewallnode
         boolean secure = true;
         List<HwLink> links = map.getTMLArchitecture().getHwLinks();
-        HwExecutionNode node1 = (HwExecutionNode) map.getHwNodeOf(t1);
-        HwExecutionNode node2 = (HwExecutionNode) map.getHwNodeOf(t2);
+        HwExecutionNode node1 =  map.getHwNodeOf(t1);
+        HwExecutionNode node2 =  map.getHwNodeOf(t2);
         List<HwNode> found = new ArrayList<HwNode>();
         List<HwNode> done = new ArrayList<HwNode>();
         List<HwNode> path = new ArrayList<HwNode>();
@@ -870,7 +870,7 @@ public class GTURTLEModeling {
         List<HwNode> done = new ArrayList<HwNode>();
         //List<HwNode> path = new ArrayList<HwNode>();
 
-        HwExecutionNode node1 = (HwExecutionNode) map.getHwNodeOf(t1);
+        HwExecutionNode node1 =  map.getHwNodeOf(t1);
 
         //Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>();
         for (HwLink link : links) {
@@ -1666,8 +1666,8 @@ public class GTURTLEModeling {
         //Check if a path between two tasks is secure
         boolean secure = true;
         List<HwLink> links = map.getTMLArchitecture().getHwLinks();
-        HwExecutionNode node1 = (HwExecutionNode) map.getHwNodeOf(t1);
-        HwExecutionNode node2 = (HwExecutionNode) map.getHwNodeOf(t2);
+        HwExecutionNode node1 = map.getHwNodeOf(t1);
+        HwExecutionNode node2 = map.getHwNodeOf(t2);
         List<HwNode> found = new ArrayList<HwNode>();
         List<HwNode> done = new ArrayList<HwNode>();
         List<HwNode> path = new ArrayList<HwNode>();
@@ -1746,7 +1746,7 @@ public class GTURTLEModeling {
                 for (TMLTask t : tmlm.securityTaskMap.get(sp)) {
                     ArrayList<HwMemory> mems = new ArrayList<HwMemory>();
                     boolean keyFound = false;
-                    HwExecutionNode node1 = (HwExecutionNode) tmap.getHwNodeOf(t);
+                    HwExecutionNode node1 = tmap.getHwNodeOf(t);
                     //Try to find memory using only private buses
                     List<HwNode> toVisit = new ArrayList<HwNode>();
                     //  List<HwNode> toMemory = new ArrayList<HwNode>();
@@ -1815,7 +1815,7 @@ public class GTURTLEModeling {
                 for (TMLTask t : tmlm.securityTaskMap.get(sp)) {
                     ArrayList<HwMemory> mems = new ArrayList<HwMemory>();
                     boolean keyFound = false;
-                    HwExecutionNode node1 = (HwExecutionNode) tmap.getHwNodeOf(t);
+                    HwExecutionNode node1 = tmap.getHwNodeOf(t);
                     //Try to find memory using only private buses
                     List<HwNode> toVisit = new ArrayList<HwNode>();
                     //  List<HwNode> toMemory = new ArrayList<HwNode>();