diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index aaf20e70019d2a9f519eab0797f2d5e9a35dfea4..d9e9154fc4a01f3350e8a296c5330632b342cc28 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -10,6 +10,9 @@
 #include "TDD-Config.h"
 #include "MBSFN-SubframeConfigList.h"
 #include "MobilityControlInfo.h"
+#ifdef Rel10
+#include "SCellToAddMod-r10.h"
+#endif 
 #else
 
 /**
@@ -269,6 +272,18 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
 
 //void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);
 
+#ifdef Rel10
+void phy_config_dedicated_scell_ue(uint8_t Mod_id,
+				   uint8_t eNB_index,
+				   SCellToAddMod_r10_t *sCellToAddMod_r10, 
+				   int CC_id);
+
+void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
+				    uint16_t rnti,
+				    SCellToAddMod_r10_t *sCellToAddMod_r10, 
+				    int CC_id);
+
+#endif 
 #endif
 
 
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 575ba5fa7b75628c3231ac81ad97cb6c2bf260e1..c2ab71c93e2fc14948511941efe83ca28c83bad8 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -590,18 +590,24 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
 
 }
 #ifdef Rel10
+void phy_config_dedicated_scell_ue(uint8_t Mod_id,
+				   uint8_t eNB_index,
+				    SCellToAddMod_r10_t *sCellToAddMod_r10, 
+				    int CC_id) {
+
+}
 void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
 				    uint16_t rnti,
 				    SCellToAddMod_r10_t *sCellToAddMod_r10, 
 				    int CC_id) {
 
   PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id][CC_id];
-  u8 UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
+  uint8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
   struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
   //struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
   PhysCellId_t physCellId_r10 = sCellToAddMod_r10->cellIdentification_r10->physCellId_r10;
   ARFCN_ValueEUTRA_t dl_CarrierFreq_r10 = sCellToAddMod_r10->cellIdentification_r10->dl_CarrierFreq_r10;
-  u32 carrier_freq_local;
+  uint32_t carrier_freq_local;
 
 #ifdef EXMIMO
 #ifdef DRIVER2013
@@ -611,7 +617,8 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
 
   if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
     carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
-    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
+#warning "fixme: update the phy frame counter "
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*phy_vars_eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
 #ifdef EXMIMO
 #ifdef DRIVER2013
     carrier_freq[CC_id] = carrier_freq_local;
@@ -628,7 +635,7 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
   else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
     carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
     // this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
-    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,/*phy_vars_eNB->frame*/0,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
 #ifdef EXMIMO
 #ifdef DRIVER2013
     carrier_freq[CC_id] = carrier_freq_local;
@@ -643,15 +650,16 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
 #endif
   }
   else {
-    LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %d of SCell %d for UE %d not supported\n",Mod_id,phy_vars_eNB->frame,dl_CarrierFreq_r10,CC_id,UE_id);
+    LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %d of SCell %d for UE %d not supported\n",Mod_id,/*phy_vars_eNB->frame*/0,dl_CarrierFreq_r10,CC_id,UE_id);
   }
 
   if (physicalConfigDedicatedSCell_r10) {
-    phy_vars_eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
-    LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,UE_id);
+#warning " phy_vars_eNB->physicalConfigDedicatedSCell_r10 does not exist in phy_vars_eNB"
+    //  phy_vars_eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
+    LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,/*phy_vars_eNB->frame*/0,CC_id,UE_id);
   }
   else {
-    LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id, phy_vars_eNB->frame,CC_id,UE_id);
+    LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id, /*phy_vars_eNB->frame*/0,CC_id,UE_id);
     return;
   }
 
diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c
index 8c304082bb8c1bdd193c73057ff18c15ec107841..ada0199d3286bf2f86c62d0e2ec6201f766c887a 100644
--- a/openair1/PHY/INIT/lte_parms.c
+++ b/openair1/PHY/INIT/lte_parms.c
@@ -46,7 +46,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) {
     frame_parms->log2_symbol_size = 11;
     frame_parms->samples_per_tti = 30720;
     frame_parms->first_carrier_offset = 2048-600;
-    frame_parms->N_RBGS = 25;
+    frame_parms->N_RBGS = 4;
+    frame_parms->N_RBG = 25;
     break;
   case 50:
     if (osf>1) {
@@ -59,7 +60,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) {
     frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300; 
     frame_parms->nb_prefix_samples>>=(1-log2_osf);
     frame_parms->nb_prefix_samples0>>=(1-log2_osf);
-    frame_parms->N_RBGS = 17;
+    frame_parms->N_RBGS = 3;
+    frame_parms->N_RBG = 17;
    break;
   case 25:
     if (osf>2) {
@@ -73,7 +75,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) {
     frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150; 
     frame_parms->nb_prefix_samples>>=(2-log2_osf);
     frame_parms->nb_prefix_samples0>>=(2-log2_osf);
-    frame_parms->N_RBGS = 13;
+    frame_parms->N_RBGS = 2;
+    frame_parms->N_RBG = 13;
     break;
   case 15:
     frame_parms->ofdm_symbol_size = 256*osf;
@@ -82,7 +85,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) {
     frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
     frame_parms->nb_prefix_samples>>=(3-log2_osf);
     frame_parms->nb_prefix_samples0>>=(3-log2_osf);
-    frame_parms->N_RBGS = 8;
+    frame_parms->N_RBGS = 2;
+    frame_parms->N_RBG = 8;
     break;
   case 6:
     frame_parms->ofdm_symbol_size = 128*osf;
@@ -91,7 +95,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) {
     frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
     frame_parms->nb_prefix_samples>>=(4-log2_osf);
     frame_parms->nb_prefix_samples0>>=(4-log2_osf);
-    frame_parms->N_RBGS = 6;
+    frame_parms->N_RBGS = 1;
+    frame_parms->N_RBG = 6;
     break;
 
   default:
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
index 4c219c83f84cf960ca5f35300c11cd807dee63d0..1282a9fea808d8e910ded4bbe012f1e55aa4b5e1 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
@@ -21,7 +21,7 @@ __m128i zeroPMI;
 #define k1 ((long long int) 1000)
 #define k2 ((long long int) (1024-k1))
 
-#define DEBUG_MEAS
+//#define DEBUG_MEAS
 
 #ifdef USER_MODE
 void print_shorts(char *s,__m128i *x) {
@@ -243,7 +243,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
       }
 
 
-
+      // 2 RE per PRB
       phy_vars_ue->PHY_measurements.rsrp[eNB_offset]/=(24*phy_vars_ue->lte_frame_parms.N_RB_DL);
       phy_vars_ue->PHY_measurements.rsrp[eNB_offset]*=rx_power_correction;
 
@@ -267,9 +267,9 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
       phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3;
 
     }
-    //if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) {
+    if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) {
 #ifdef DEBUG_MEAS
-    //if (eNB_offset == 0)
+    if (eNB_offset == 0)
 	LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",phy_vars_ue->Mod_id,
 	      phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB,
 	      10*log10(phy_vars_ue->PHY_measurements.rssi));
@@ -286,7 +286,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
     //LOG_D(PHY,"gain_loss_dB: %d \n",phy_vars_ue->rx_total_gain_dB);
     //LOG_D(PHY,"gain_fixed_dB: %d \n",dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12));
 #endif
-    //}
+    }
   }
 }
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
index 7ae6be601dac6608aa02d4e17db8ba8532974b6a..ff86b0691e0bf9117b7fc8c074b1afc8129e0e54 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c
@@ -525,13 +525,13 @@ uint32_t get_rballoc(uint8_t vrb_type,uint16_t rb_alloc_dci) {
 
 }
 
-uint8_t get_transmission_mode(uint16_t Mod_id, uint16_t rnti) {
+uint8_t get_transmission_mode(uint16_t Mod_id, uint8_t CC_id, uint16_t rnti) {
   unsigned char UE_id;
 
   // find the UE_index corresponding to rnti
-  UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
+  UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]);
 
-  return(PHY_vars_eNB_g[Mod_id][0]->transmission_mode[UE_id]);
+  return(PHY_vars_eNB_g[Mod_id][CC_id]->transmission_mode[UE_id]);
 }
 
 int generate_eNB_dlsch_params_from_dci(uint8_t subframe,
diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c
index 0a1ed73432e76d97a0abdf963a0946940ba34719..49798e6219a9dae547a012ad59208aa83251fa04 100644
--- a/openair1/PHY/LTE_TRANSPORT/print_stats.c
+++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c
@@ -29,11 +29,11 @@
 
 /*! \file PHY/LTE_TRANSPORT/print_stats.c
 * \brief PHY statstic logging function
-* \author R. Knopp, F. Kaltenberger
+* \author R. Knopp, F. Kaltenberger, navid nikaein
 * \date 2011
 * \version 0.1
 * \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
 * \note
 * \warning
 */
@@ -347,7 +347,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
 		     phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][0],
 		     phy_vars_eNB->PHY_measurements_eNB[eNB].wideband_cqi_dB[UE_id][1]);
       
-      len += sprintf(&buffer[len],"[eNB PROC] Subband CQI: ");
+      len += sprintf(&buffer[len],"[eNB PROC] Subband CQI:    ");
       for (i=0;i<25;i++)
 	len += sprintf(&buffer[len],"%2d ",
 		       phy_vars_eNB->PHY_measurements_eNB[eNB].subband_cqi_tot_dB[UE_id][i]);
@@ -357,6 +357,12 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
 		     phy_vars_eNB->eNB_UE_stats[UE_id].DL_cqi[0],
 		     pmi2hex_2Ar1(phy_vars_eNB->eNB_UE_stats[UE_id].DL_pmi_single));
       
+      len += sprintf(&buffer[len],"[eNB PROC] DL Subband CQI: ");
+      for (i=0;i<13;i++)
+	len += sprintf(&buffer[len],"%2d ",
+		       phy_vars_eNB->eNB_UE_stats[UE_id].DL_subband_cqi[0][i]);
+      len += sprintf(&buffer[len],"\n");
+      
       len += sprintf(&buffer[len],"[eNB PROC] Timing advance %d samples (%d 16Ts), update %d\n",
 		     phy_vars_eNB->eNB_UE_stats[UE_id].UE_timing_offset,
 		     phy_vars_eNB->eNB_UE_stats[UE_id].UE_timing_offset>>2,
diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h
index c01948dba91fb554ab81443b7fd6458dad3cdc55..a27150b56c5c2d71f3276645ddbe1bbcb3b0b8c4 100644
--- a/openair1/PHY/LTE_TRANSPORT/proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/proto.h
@@ -1222,7 +1222,7 @@ uint32_t get_rballoc(uint8_t vrb_type,uint16_t rb_alloc_dci);
 /* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type
    @returns Transmission mode (1-7)
 */
-uint8_t get_transmission_mode(uint16_t Mod_id, uint16_t rnti);
+uint8_t get_transmission_mode(uint16_t Mod_id, uint8_t CC_id, uint16_t rnti);
 
 /* \brief 
    @param ra_header Header of resource allocation (0,1) (See sections 7.1.6.1/7.1.6.2 of 36.213 Rel8.6)
diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/defs.h
index 641c623aea2fb7457b0e3911ce8174e08f3d5f11..422d2f7969ca68884b13bd495c8b3a9aae6e5d84 100644
--- a/openair1/PHY/TOOLS/defs.h
+++ b/openair1/PHY/TOOLS/defs.h
@@ -509,6 +509,8 @@ int8_t dB_fixed(uint32_t x);
 
 int8_t dB_fixed2(uint32_t x,uint32_t y);
 
+int16_t dB_fixed_times10(uint32_t x);
+
 int32_t phy_phase_compensation_top (uint32_t pilot_type, uint32_t initial_pilot,
 				uint32_t last_pilot, int32_t ignore_prefix);
 
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index 18707c54b6e7ef9b60ccd234deab5dbb58c05227..b9e87fc04e697b2dee0a164d7b8ae828623f7755 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -419,7 +419,9 @@ typedef struct {
   uint8_t N_RB_DL;
   /// Number of resource blocks (RB) in UL
   uint8_t N_RB_UL;
-/// Number of Resource Block Groups for P=2
+  ///  total Number of Resource Block Groups: this is ceil(N_PRB/P)
+  uint8_t N_RBG;
+  /// Total Number of Resource Block Groups SubSets: this is P
   uint8_t N_RBGS;
   /// Cell ID                 
   uint16_t Nid_cell;
diff --git a/openair1/PHY/vars.h b/openair1/PHY/vars.h
index 3f0e78f1205d3b9775dda8e3375a91044b791eee..4df3f9efdbaa00efa12592c151f54a66ad2d0baa 100755
--- a/openair1/PHY/vars.h
+++ b/openair1/PHY/vars.h
@@ -89,7 +89,8 @@ double sinr_to_cqi[4][16]={ {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012,
   {-1, -1.0000, -0.4198, -0.0140, 1.0362,  2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392},
   { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} };
 
-int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
+//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
+int cqi_to_mcs[16]={0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
 
 //for SNR to MI conversion 7 th order Polynomial coeff
 double q_qam16[8]={3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h
index 9fb7231bf9bfc53a047640d7b07a446d6c410c26..2d14d0d7c8ba1b25d3aeaa874d5bc01136d391b4 100644
--- a/openair1/SCHED/defs.h
+++ b/openair1/SCHED/defs.h
@@ -493,7 +493,12 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
 
 int8_t get_PHR(uint8_t Mod_id, uint8_t eNB_index);
 
-LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, int CC_id,uint16_t rnti);
+LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
+
+LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id);
+
+MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id);
+
 int get_ue_active_harq_pid(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti,uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag);
 void ulsch_decoding_procedures(unsigned char last_slot, unsigned int i, PHY_VARS_eNB *phy_vars_eNB, unsigned char abstraction_flag);
 
diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 91bc5c5cb17e79c9f0a1938501f60a045d83f55c..734524641fa3f0de30a931091e6c4cf420537eb5 100755
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -544,7 +544,7 @@ unsigned int is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
 }
 
 
-LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, int CC_id,uint16_t rnti) {
+LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint8_t  CC_id,uint16_t rnti) {
   int8_t UE_id;
   if ((PHY_vars_eNB_g == NULL) || (PHY_vars_eNB_g[Mod_id] == NULL) || (PHY_vars_eNB_g[Mod_id][CC_id]==NULL)) {
     LOG_E(PHY,"get_eNB_UE_stats: No phy_vars_eNB found (or not allocated) for Mod_id %d,CC_id %d\n",Mod_id,CC_id);
@@ -580,3 +580,13 @@ int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB) {
   return(-1);
 }
 
+LTE_DL_FRAME_PARMS* get_lte_frame_parms(module_id_t Mod_id, uint8_t  CC_id){
+
+  return(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms);
+
+}
+
+MU_MIMO_mode *get_mu_mimo_mode (module_id_t Mod_id, uint8_t  CC_id){
+
+  return(&PHY_vars_eNB_g[Mod_id][CC_id]->mu_mimo_mode);
+}
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 4acd13c5aea868fbbc0fb6973bb3e1bc89e5586e..7c738d65f466e22d35f84537d84bde0d56999e95 100755
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -1890,14 +1890,16 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
   }
 #ifdef PHY_ABSTRACTION
   else {
-    for (i=0;i<NB_eNB_INST;i++) 
-      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++){
-      if (PHY_vars_eNB_g[i][CC_id]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
+    for (i=0;i<NB_eNB_INST;i++) {
+      for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
+	if (PHY_vars_eNB_g[i][CC_id]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
+	  break;
+      if (CC_id < MAX_NUM_CCs)
 	break;
     }
     if (i==NB_eNB_INST) {
       LOG_E(PHY,"[UE  %d] phy_procedures_lte_ue.c: FATAL : Could not find attached eNB for DCI emulation (Nid_cell %d)!!!!\n",phy_vars_ue->Mod_id,phy_vars_ue->lte_frame_parms.Nid_cell);
-      mac_xface->macphy_exit("");
+      mac_xface->macphy_exit("Could not find attached eNB for DCI emulation");
       vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT);
       return(-1);
     }
@@ -3076,7 +3078,13 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
       LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation(%d)\n",
 	    phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,last_slot);
 #ifdef Rel10
-      pmch_mcs = mac_xface->ue_query_mch(phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,eNB_id,&sync_area,&mcch_active);
+      pmch_mcs = mac_xface->ue_query_mch(phy_vars_ue->Mod_id,
+					 phy_vars_ue->CC_id,
+					 ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,
+					 last_slot>>1,
+					 eNB_id,
+					 &sync_area,
+					 &mcch_active);
       if (phy_vars_rn)
 	phy_vars_rn->mch_avtive[last_slot>>1]=0;
 #else
@@ -3166,6 +3174,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
 #ifdef Rel10
 	  if ((r_type == no_relay) || (mcch_active == 1)) {
 	    mac_xface->ue_send_mch_sdu(phy_vars_ue->Mod_id,
+				       phy_vars_ue->CC_id,
 				       ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,
 				       phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b,
 				       phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3,
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 917d4f129255f3813e163cc892cb962289755cc5..15bc3d9606e9cad9a6ef80d72b3cf0b15d4101ad 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -666,7 +666,7 @@ int main(int argc, char **argv) {
     hostname[1023] = '\0';
     gethostname(hostname, 1023);
     printf("Hostname: %s\n", hostname);
-    sprintf(time_meas_fname,"%s/TEST/OAI/PERF_%s/time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
+    sprintf(time_meas_fname,"%s/SIMU/USER/pre-ci-logs-%s/time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
 	    getenv("OPENAIR_TARGETS"),hostname,
 	    N_RB_DL,mcs,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode);
     time_meas_fd = fopen(time_meas_fname,"w");
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 2f17ba147b48cb1f74fe5bedd331392d5c39905c..070f80c7e08caff5007417eb8b06e9cda9be0ccc 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -521,7 +521,7 @@ int main(int argc, char **argv) {
     hostname[1023] = '\0';
     gethostname(hostname, 1023);
     printf("Hostname: %s\n", hostname);
-    sprintf(time_meas_fname,"%s/TEST/OAI/PERF_%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
+    sprintf(time_meas_fname,"%s//SIMU/USER/pre-ci-logs-%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
 	    getenv("OPENAIR_TARGETS"),hostname,
 	    N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode);
     time_meas_fd = fopen(time_meas_fname,"w");
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index a67fa091d087aa63837877683f9e40023aa03123..6f72ecab2ed177ce86d6d2ae658c3e25f33444f1 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -244,10 +244,11 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui
 #ifdef Rel10
   if (sCellToAddMod_r10 != NULL) {
     
-    if (eNB_flag==1){
+    if (eNB_flagP==1){
       mac_xface->phy_config_dedicated_scell_eNB(Mod_id,UE_RNTI(Mod_id,UE_id),sCellToAddMod_r10,1);
     }
     else {
+#warning "phy_config_dedicated_scell_ue is empty"
       mac_xface->phy_config_dedicated_scell_ue(Mod_id,eNB_index,sCellToAddMod_r10,1);
       UE_mac_inst[Mod_id].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0
     }
@@ -420,7 +421,7 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui
 
               // MBMS session info list in each MCH
               eNB_mac_inst[Mod_id].common_channels[0].mbms_SessionList[i] = &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9;
-              LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n",i, eNB_mac_inst[Mod_id].mbms_SessionList[i]->list.count);
+              LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n",i, eNB_mac_inst[Mod_id].common_channels[0].mbms_SessionList[i]->list.count);
           }
       }
       else { // UE
diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h
index 6850dcf143b9b2fbfc90951c3e80a13ebd943915..a4aa0b3d4fcab5c61e97db33a90d026e5f31b0f5 100644
--- a/openair2/LAYER2/MAC/defs.h
+++ b/openair2/LAYER2/MAC/defs.h
@@ -128,7 +128,11 @@
 // The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1
 #define PHR_MAPPING_OFFSET 23  // if ( x>= -23 ) val = floor (x + 23) 
 
-#define N_RBGS_MAX 25
+#define N_RBG_MAX 25 // for 20MHz channel BW
+
+#define MIN_CQI_VALUE  0
+#define MAX_CQI_VALUE  15
+
 
 #define LCGID0 0
 #define LCGID1 1
@@ -529,6 +533,8 @@ typedef struct{
   
   uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
 
+  uint32_t  dl_buffer_head_sdu_creation_time_max;
+  
   uint8_t    dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
 
   uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
@@ -702,7 +708,7 @@ typedef struct{
   ///  active flag for Other lcid 
   //  uint8_t lcid_active[NB_RB_MAX];
   // eNB stats 
-  eNB_STATS eNB_stats;
+  eNB_STATS eNB_stats[MAX_NUM_CCs];
   // MAC function execution peformance profiler
   time_stats_t eNB_scheduler;
   time_stats_t schedule_si;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 846800fb3a9f4bff056c474845ee48912df81e83..8cf70be558eb7526f29838ee502ac5b0561f262a 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -82,7 +82,6 @@
 
 void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) {//, int calibration_flag) {
 
-  start_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
   unsigned int nprb[MAX_NUM_CCs];
   unsigned int nCCE[MAX_NUM_CCs];
   int mbsfn_status[MAX_NUM_CCs];
@@ -101,9 +100,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
 
   LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler\n",module_idP, frameP, subframeP);
 
-
-
-  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,1);
+  start_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
 
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
     DCI_pdu[CC_id] = &eNB_mac_inst[module_idP].common_channels[CC_id].DCI_pdu;
@@ -170,7 +168,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
     eNB_mac_inst[module_idP].common_channels[CC_id].bcch_active = 0;
     
 #ifdef Rel10
-    eNB_mac_inst[module_idP].common_channels.mcch_active =0;
+    eNB_mac_inst[module_idP].common_channels[CC_id].mcch_active =0;
 #endif
     
     eNB_mac_inst[module_idP].frame    = frameP;
@@ -181,22 +179,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
 #ifdef EXMIMO
   pdcp_run(frameP, 1, 0, module_idP);
 #endif
-#ifdef CELLULAR
-  rrc_rx_tx(module_idP, frameP, 0, 0);
-#else
+
   // check HO
   rrc_rx_tx(module_idP,
-      frameP,
-      1,
-      module_idP);
-#endif
+	    frameP,
+	    1,
+	    module_idP);
 
 #ifdef Rel10
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-    if (eNB_mac_inst[module_idP].common_channels.MBMS_flag >0) {
-      start_meas(&eNB_mac_inst[module_idP].common_channels.schedule_mch);
-      mbsfn_status = schedule_MBMS(module_idP,CC_id,frameP,subframeP);
-      stop_meas(&eNB_mac_inst[module_idP][CC-id].schedule_mch);
+    if (eNB_mac_inst[module_idP].common_channels[CC_id].MBMS_flag >0) {
+      start_meas(&eNB_mac_inst[module_idP].schedule_mch);
+      mbsfn_status[CC_id] = schedule_MBMS(module_idP,CC_id,frameP,subframeP);
+      stop_meas(&eNB_mac_inst[module_idP].schedule_mch);
     }
   }
 #endif
@@ -473,9 +468,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
     DCI_pdu[CC_id]->nCCE = nCCE[CC_id];
   LOG_D(MAC,"frameP %d, subframeP %d nCCE %d\n",frameP,subframeP,nCCE[0]);
 
-  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,0);
   stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
-
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
+ 
 }
 
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 6494702ddcf2e9437370bbf3691a241a4f1ca1f9..1833858c1de5f35397e2e8dc2e351102f8c5d033 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -67,6 +67,7 @@
 # include "intertask_interface.h"
 #endif
 
+extern inline unsigned int taus(void);
 
 void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,unsigned char Msg3_subframe,unsigned int *nprb,unsigned int *nCCE) {
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 36ca01a81ead80648824313e0ed0e37c81a690a2..33a08c5ded8fac9f35115e308fe62b517debacc4 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -15,8 +15,8 @@
 
     You should have received a copy of the GNU General Public License
     along with OpenAirInterface.The full GNU General Public License is
-   included in this distribution in the file called "COPYING". If not,
-   see <http://www.gnu.org/licenses/>.
+    included in this distribution in the file called "COPYING". If not,
+    see <http://www.gnu.org/licenses/>.
 
   Contact Information
   OpenAirInterface Admin: openair_admin@eurecom.fr
@@ -298,237 +298,156 @@ void schedule_ue_spec(module_id_t   module_idP,
                       unsigned int  *nCCE_used,
                       int           *mbsfn_flag) {
 
-  int                   CC_id;
+  uint8_t               CC_id;
   int                   UE_id;
   uint16_t              nCCE[MAX_NUM_CCs];
-  int                   N_RBGS[MAX_NUM_CCs];
+  int                   N_RBG[MAX_NUM_CCs];
   unsigned char         aggregation;
   mac_rlc_status_resp_t rlc_status;
   unsigned char         header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0;
   unsigned char         sdu_lcids[11],offset,num_sdus=0;
-  uint16_t                   nb_rb,nb_rb_temp,nb_available_rb,TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0;
+  uint16_t              nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; 
+  uint16_t              TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0;
   unsigned char         dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
   unsigned char         round            = 0;
   unsigned char         harq_pid         = 0;
   void                 *DLSCH_dci        = NULL;
   LTE_eNB_UE_stats     *eNB_UE_stats     = NULL;
-  uint16_t                   sdu_length_total = 0;
+  uint16_t              sdu_length_total = 0;
   unsigned char         DAI;
-  int                   i;
-  uint8_t                    dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  unsigned char         rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBGS_MAX];
-  uint16_t                   pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+  int                   i                = 0;
+  uint8_t               dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+  unsigned char         rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX];
+  uint16_t              pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
   int                   mcs;
-  uint16_t                   min_rb_unit[MAX_NUM_CCs];
+  uint16_t              min_rb_unit[MAX_NUM_CCs];
   short                 ta_update        = 0;
   eNB_MAC_INST         *eNB      = &eNB_mac_inst[module_idP];
   UE_list_t            *UE_list  = &eNB->UE_list;
-
-  reset_meas(&eNB->schedule_dlsch);
+  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs];
   if (UE_list->head==-1)
     return;
-
-  for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-    switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL) {
-    case 6:
-      min_rb_unit[CC_id]=1;
-      break;
-    case 25:
-      min_rb_unit[CC_id]=2;
-      break;
-    case 50:
-      min_rb_unit[CC_id]=3;
-      break;
-    case 100:
-      min_rb_unit[CC_id]=4;
-      break;
-    default:
-      min_rb_unit[CC_id]=2;
-      break;
-    }
-  }
+  
+  start_meas(&eNB->schedule_dlsch);
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN);
 
   //weight = get_ue_weight(module_idP,UE_id);
   aggregation = 1; // set to the maximum aggregation level
 
-
-
-
-
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
-
-    // set current available nb_rb and nCCE to maximum
-    nb_available_rb = PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL - nb_rb_used0[CC_id];
-      
-    /// Initialization for pre-processor
-    for(i=UE_list->head;i>=0;i=UE_list->next[i]){
-      pre_nb_available_rbs[CC_id][i] = 0;
-      dl_pow_off[CC_id][i] = 2;
-
-      for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++){
-	//       rballoc_sub[j] = 0;
-	rballoc_sub_UE[CC_id][i][j] = 0;
-      }
-    }
-      
-      
-    for (i = UE_list->head; i>=0; i=UE_list->next[i]) {
-      PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[i].pre_nb_available_rbs = 0;
-      for (j = 0; j < PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS; j++) {
-	PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[i].rballoc_sub[j] = 0;
-      }
-    }
-      
+    min_rb_unit[CC_id]=get_min_rb_unit(module_idP,CC_id);
+    frame_parms[CC_id] = mac_xface->get_lte_frame_parms(module_idP,CC_id); 
+    total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used0[CC_id];
     nCCE[CC_id] = mac_xface->get_nCCE_max(module_idP,CC_id) - nCCE_used[CC_id];
-    N_RBGS[CC_id] = PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;
-    // store the goloabl enb stats
-    eNB->eNB_stats.num_dlactive_UEs =  UE_list->num_UEs;
-    eNB->eNB_stats.available_prbs =  nb_available_rb;
-    eNB->eNB_stats.total_available_prbs +=  nb_available_rb;
-    eNB->eNB_stats.available_ncces = nCCE[CC_id];
-    eNB->eNB_stats.dlsch_bytes_tx=0;
-    eNB->eNB_stats.dlsch_pdus_tx=0;
+    N_RBG[CC_id] = frame_parms[CC_id]->N_RBG;
+
+    // store the global enb stats: 
+    eNB->eNB_stats[CC_id].num_dlactive_UEs =  UE_list->num_UEs;
+    eNB->eNB_stats[CC_id].available_prbs =  total_nb_available_rb[CC_id];
+    eNB->eNB_stats[CC_id].total_available_prbs +=  total_nb_available_rb[CC_id];
+    eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id];
+    eNB->eNB_stats[CC_id].dlsch_bytes_tx=0;
+    eNB->eNB_stats[CC_id].dlsch_pdus_tx=0;
   }
    
   /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band)
+  
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN);
   start_meas(&eNB->schedule_dlsch_preprocessor);
-  printf("preprocessor in\n");
   dlsch_scheduler_pre_processor(module_idP,
 				frameP,
 				subframeP,
 				dl_pow_off,
 				pre_nb_available_rbs,
-				N_RBGS,
+				N_RBG,
 				rballoc_sub_UE,
 				mbsfn_flag);
   stop_meas(&eNB->schedule_dlsch_preprocessor);
-  printf("preprocessor out\n");
-
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT);
+ 
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
     if (mbsfn_flag[CC_id]>0)
       continue;
     for (UE_id=UE_list->head;UE_id>=0;UE_id=UE_list->next[UE_id]) {
 
-
- 
       rnti = UE_RNTI(module_idP,UE_id);
-
-      printf("Scheduling UE %d for CC_id %d (rnti %x)\n",UE_id,CC_id,rnti);
-     
-      UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
-      UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_get_rrc_status(module_idP,1,UE_id);
+      eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
       if (rnti==0) {
-	LOG_E(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs);
-	mac_xface->macphy_exit("Cannot find rnti for UE_id");//continue;
+	LOG_N(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs);
+	// mac_xface->macphy_exit("Cannot find rnti for UE_id");
+	continue;
       }
-      
-      eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
-      if (eNB_UE_stats==NULL)
-	mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n");
-      
-      // Get candidate harq_pid from PHY
-      mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,subframeP,&harq_pid,&round,0);
-      printf("Got harq_pid %d, round %d\n",harq_pid,round);
-      
-      
-      nb_available_rb = pre_nb_available_rbs[CC_id][UE_id];
-      
-      if ((nb_available_rb == 0) || (nCCE[CC_id] < (1<<aggregation))) {
-	LOG_D(MAC,"UE %d, CC_id %d: nb_availiable_rb exhausted (nb_rb_used %d, nb_available_rb %d, nCCE %d, aggregation %d)\n",
-	      UE_id, CC_id, nb_rb_used0[CC_id], nb_available_rb, nCCE[CC_id], aggregation);
+      if (eNB_UE_stats==NULL) {
+	LOG_N(MAC,"[eNB] Cannot find eNB_UE_stats\n");
+	//	mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n");
+	continue; 
+      }
+      if ((pre_nb_available_rbs[CC_id][UE_id] == 0) || (nCCE[CC_id] < (1<<aggregation))) {
+	LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
+	      module_idP, frameP, UE_id, CC_id, nb_rb_used0[CC_id], pre_nb_available_rbs[CC_id][UE_id], nCCE[CC_id], aggregation);
 	//if(mac_xface->get_transmission_mode(module_idP,rnti)==5)
 	continue; //to next user (there might be rbs availiable for other UEs in TM5
 	// else
 	//	break;
       }
-      sdu_length_total=0;
-      num_sdus=0;
-      
-      // get Round-Robin allocation
-      
-      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
-	switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.tdd_config) {
-	case 0:
-	  if ((subframeP==0)||(subframeP==1)||(subframeP==3)||(subframeP==5)||(subframeP==6)||(subframeP==8))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	case 1:
-	  if ((subframeP==0)||(subframeP==4)||(subframeP==5)||(subframeP==9))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	  break;
-	case 2:
-	  if ((subframeP==4)||(subframeP==5))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	  break;
-	case 3:
-	  if ((subframeP==5)||(subframeP==7)||(subframeP==9))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	  break;
-	case 4:
-	  if ((subframeP==0)||(subframeP==6))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	  break;
-	case 5:
-	  if (subframeP==9)
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	  break;
-	case 6:
-	  if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6)||(subframeP==9))
-	    UE_list->UE_template[CC_id][UE_id].DAI = 0;
-	default:
-	  break;
-	}
-      }	
-	  
-      // This is an allocated UE_id
-      rnti = UE_RNTI(module_idP,UE_id);
-      if (rnti==0)
-	continue;
+      if (frame_parms[CC_id]->frame_type == TDD) 
+	set_ue_dai (subframeP,
+		    frame_parms[CC_id]->tdd_config,
+		    UE_id,
+		    CC_id,
+		    UE_list);
       
-      eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
+      nb_available_rb = pre_nb_available_rbs[CC_id][UE_id];
+      UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti;
+      UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_get_rrc_status(module_idP,1,UE_id);
+      mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,subframeP,&harq_pid,&round,0);
+      UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
+      UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
       
-      if (eNB_UE_stats==NULL)
-	mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n");
+      sdu_length_total=0;
+      num_sdus=0;
       
       if (openair_daq_vars.target_ue_dl_mcs <= 0) {
+	/*	
+	DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), 
+		eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE);
+	*/
 	eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
 	LOG_T(MAC,"CQI %d\n",eNB_UE_stats->DL_cqi[0]);
       }
       else
 	eNB_UE_stats->dlsch_mcs1 = openair_daq_vars.target_ue_dl_mcs;
-      
-      
-      if(eNB_UE_stats->dlsch_mcs1>22)
-	eNB_UE_stats->dlsch_mcs1=22;
-      
-      
-      // for TM5, limit the MCS to 16QAM
-      
-      
-      // for EXMIMO, limit the MCS to 16QAM as well
+
 #ifdef EXMIMO
-      eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16);
+      if (mac_xface->get_transmission_mode(module_idP,CC_id, rnti)==5)
+	eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16);
 #endif
-      
-      // Get candidate harq_pid from PHY
-      mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,subframeP,&harq_pid,&round,0);
-      
-      UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
-      UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
-      // Note this code is for a specific DCI format
-      DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
-      
-      for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++){ // initializing the rb allocation indicator for each UE
-	UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
-      }
       // store stats
       UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0];
+      // initializing the rb allocation indicator for each UE
+      for(j=0;j<frame_parms[CC_id]->N_RBG;j++){ 
+	UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
+      }
+
+      LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, available rb %d, cqi %d, mcs %d, rrc status %d)\n",
+	    module_idP, frameP, UE_id,CC_id,rnti,harq_pid, round,nb_available_rb,
+	    eNB_UE_stats->DL_cqi[0], eNB_UE_stats->dlsch_mcs1,
+	    UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status);
+                
+     
+      // Note this code is for a specific DCI format
+      DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
       
+          
+      /* process retransmission  */
+
       if (round > 0) {
-	if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	
+	if (frame_parms[CC_id]->frame_type == TDD) {
 	  UE_list->UE_template[CC_id][UE_id].DAI++;
-	  LOG_D(MAC,"DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
-	  
 	  update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI);
+	  LOG_D(MAC,"DAI update: subframeP %d: UE %d, DAI %d\n",
+		subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
 	}
 	
 	// get freq_allocation
@@ -536,26 +455,25 @@ void schedule_ue_spec(module_id_t   module_idP,
 	if (nb_rb <= nb_available_rb) {
 	  
 	  if(nb_rb == pre_nb_available_rbs[CC_id][UE_id]){
-	    for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++) // for indicating the rballoc for each sub-band
-	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];}
-	  else
-	    {
-	      nb_rb_temp = nb_rb;
-	      j = 0;
-	      while((nb_rb_temp > 0) && (j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS)){
-		if(rballoc_sub_UE[CC_id][UE_id][j] == 1){
-		  UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];
-		  if((j == PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS-1) &&
-		     ((PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		      (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL == 50)))
-		    nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
-		  else
-		    nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
-		}
-		j = j+1;
+	    for(j=0;j<frame_parms[CC_id]->N_RBG;j++) // for indicating the rballoc for each sub-band
+	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];
+	  } else {
+	    nb_rb_temp = nb_rb;
+	    j = 0;
+	    while((nb_rb_temp > 0) && (j<frame_parms[CC_id]->N_RBG)){
+	      if(rballoc_sub_UE[CC_id][UE_id][j] == 1){
+		UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];
+		if((j == frame_parms[CC_id]->N_RBG-1) &&
+		   ((frame_parms[CC_id]->N_RB_DL == 25)||
+		    (frame_parms[CC_id]->N_RB_DL == 50)))
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
+		else
+		  nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
 	      }
+	      j = j+1;
 	    }
-	      
+	  }
+	  
 	  nb_available_rb -= nb_rb;
 	  aggregation = process_ue_cqi(module_idP,UE_id);
 	  nCCE[CC_id]-=(1<<aggregation); // adjust the remaining nCCE
@@ -564,17 +482,16 @@ void schedule_ue_spec(module_id_t   module_idP,
 	      
 	  PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
 	  PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[CC_id][UE_id];
-	      
-	  for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++)
+	  for(j=0;j<frame_parms[CC_id]->N_RBG;j++)
 	    PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
 	      
 	  switch (mac_xface->get_transmission_mode(module_idP,CC_id,rnti)) {
 	  case 1:
 	  case 2:
 	  default:
-	    switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL) {
+	    switch (frame_parms[CC_id]->N_RB_DL) {
 	    case 6:
-	      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	      if (frame_parms[CC_id]->frame_type == TDD) {
 		//	      ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi      = 0;
 		((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid;
 		((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv       = round&3;
@@ -590,7 +507,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	      }
 	      break;
 	    case 25:
-	      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	      if (frame_parms[CC_id]->frame_type == TDD) {
 		//	      ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi      = 0;
 		((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid;
 		((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv       = round&3;
@@ -606,7 +523,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	      }
 	      break;
 	    case 50:
-	      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	      if (frame_parms[CC_id]->frame_type == TDD) {
 		//	      ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi      = 0;
 		((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid;
 		((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv       = round&3;
@@ -622,7 +539,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	      }
 	      break;
 	    case 100:
-	      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	      if (frame_parms[CC_id]->frame_type == TDD) {
 		//	      ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi      = 0;
 		((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid;
 		((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv       = round&3;
@@ -687,13 +604,11 @@ void schedule_ue_spec(module_id_t   module_idP,
 	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1;
 	  UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1;
 	}
-	else { // don't schedule this UE, its retransmission takes more resources than we have
-	  
+	else { 
+	  LOG_D(MAC,"[eNB %d] Frame %d : don't schedule UE %d, its retransmission takes more resources than we have\n", module_idP, frameP, UE_id);
 	}
       }
-      else {  // This is a potentially new SDU opportunity
-	
-	// calculate mcs
+      else {  /* This is a potentially new SDU opportunity */ 
 	
 	rlc_status.bytes_in_buffer = 0;
 	// Now check RLC information to compute number of required RBs
@@ -859,19 +774,19 @@ void schedule_ue_spec(module_id_t   module_idP,
 	  }
 	  
 	  if(nb_rb == pre_nb_available_rbs[CC_id][UE_id]) {
-	    for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++) {// for indicating the rballoc for each sub-band
+	    for(j=0;j<frame_parms[CC_id]->N_RBG;j++) {// for indicating the rballoc for each sub-band
 	      UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];
 	    }
 	  } else
 	    {
 	      nb_rb_temp = nb_rb;
 	      j = 0;
-	      while((nb_rb_temp > 0) && (j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS)){
+	      while((nb_rb_temp > 0) && (j<frame_parms[CC_id]->N_RBG)){
 		if(rballoc_sub_UE[CC_id][UE_id][j] == 1){
 		  UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = rballoc_sub_UE[CC_id][UE_id][j];
-		  if ((j == PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS-1) &&
-		      ((PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		       (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL == 50)))
+		  if ((j == frame_parms[CC_id]->N_RBG-1) &&
+		      ((frame_parms[CC_id]->N_RB_DL == 25)||
+		       (frame_parms[CC_id]->N_RB_DL == 50)))
 		    nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1;
 		  else
 		    nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
@@ -883,7 +798,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	  PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
 	  PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[CC_id][UE_id];
 	  
-	  for(j=0;j<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;j++)
+	  for(j=0;j<frame_parms[CC_id]->N_RBG;j++)
 	    PHY_vars_eNB_g[module_idP][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
 	  
 	  
@@ -939,9 +854,9 @@ void schedule_ue_spec(module_id_t   module_idP,
 					 padding,
 					 post_padding);
 	  //#ifdef DEBUG_eNB_SCHEDULER
-	  LOG_I(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, UE_id %d,padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
-		module_idP,sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,
-		ta_len,UE_id,padding,post_padding,mcs,TBS,nb_rb,header_len_dcch,header_len_dtch);
+	  LOG_I(MAC,"[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
+		module_idP,frameP, UE_id, CC_id, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,
+		ta_len,padding,post_padding,mcs,TBS,nb_rb,header_len_dcch,header_len_dtch);
 	  //#endif
 	  
 	  LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n");
@@ -979,8 +894,8 @@ void schedule_ue_spec(module_id_t   module_idP,
 			    subframeP,
 			    S_DL_SCHEDULED);
 	  // store stats
-	  eNB->eNB_stats.dlsch_bytes_tx+=sdu_length_total;
-	  eNB->eNB_stats.dlsch_pdus_tx+=1;
+	  eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
+	  eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
 	  
 	  UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
 	  UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
@@ -994,7 +909,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	  UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS;
 	  UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1;
 	  
-	  if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+	  if (frame_parms[CC_id]->frame_type == TDD) {
 	    UE_list->UE_template[CC_id][UE_id].DAI++;
 	    //	printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI);
 #warning only for 5MHz channel 
@@ -1005,8 +920,8 @@ void schedule_ue_spec(module_id_t   module_idP,
 	  case 1:
 	  case 2:
 	  default:
-	    if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
-	      switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL) {
+	    if (frame_parms[CC_id]->frame_type == TDD) {
+	      switch (frame_parms[CC_id]->N_RB_DL) {
 	      case 6:
 		((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = mcs;
 		((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid;
@@ -1046,7 +961,7 @@ void schedule_ue_spec(module_id_t   module_idP,
 	      }
 	    }
 	    else {
-	      switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_DL) {
+	      switch (frame_parms[CC_id]->N_RB_DL) {
 	      case 6:
 		((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = mcs;
 		((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid;
@@ -1130,12 +1045,12 @@ void schedule_ue_spec(module_id_t   module_idP,
 
 	}
       }
-      if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) {
+      if (frame_parms[CC_id]->frame_type == TDD) {
 	DAI = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3;
 	LOG_D(MAC,"[eNB %d] Frame %d: DAI %d for UE %d\n",module_idP,frameP,DAI,UE_id);
 	// Save DAI for Format 0 DCI
 
-	switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.tdd_config) {
+	switch (frame_parms[CC_id]->tdd_config) {
 	case 0:
 	  //      if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6))
 	  break;
@@ -1185,7 +1100,8 @@ void schedule_ue_spec(module_id_t   module_idP,
   //printf("MAC nCCE : %d\n",*nCCE_used);
 
 
-  stop_meas(&eNB->schedule_dlsch);
+  stop_meas(&eNB->schedule_dlsch); 
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT);
     
 }
 
@@ -1196,7 +1112,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
   uint8_t            first_rb,nb_rb=3;
   rnti_t        rnti;
   unsigned char vrb_map[100];
-  uint8_t            rballoc_sub[25];
+  uint8_t            rballoc_sub[25]; 
   //uint8_t number_of_subbands=13;
   uint32_t           *rballoc=RBallocP;
 
@@ -1214,7 +1130,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
 
 
   start_meas(&eNB->fill_DLSCH_dci);
-
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_IN);
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
 
     if (mbsfn_flagP[CC_id]>0)
@@ -1788,7 +1704,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
 
 
 	/// Synchronizing rballoc with rballoc_sub
-	for(i=0;i<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBGS;i++){
+	for(i=0;i<PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RBG;i++){
 	  rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i];
 	  if(rballoc_sub[i] == 1)
 	    rballoc[CC_id] |= (0x0001<<i);  // TO be FIXED!!!!!!
@@ -1943,6 +1859,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
 
   }
   stop_meas(&eNB->fill_DLSCH_dci);
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_OUT);
 }
 
 unsigned char *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rntiP, uint8_t TBindex) {
@@ -1954,8 +1871,7 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
     LOG_D(MAC,"[eNB %d] Frame %d Get DLSCH sdu for BCCH \n",module_idP,frameP);
 
     return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
-  }
-  else if ((UE_id = find_UE_id(module_idP,rntiP)) != UE_INDEX_INVALID ){
+  } else if ((UE_id = find_UE_id(module_idP,rntiP)) != UE_INDEX_INVALID ){
     LOG_D(MAC,"[eNB %d] Frame %d:  CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id);
     return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
   } else {
@@ -1964,3 +1880,61 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
   }
 
 }
+
+
+void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai) {
+
+  DCI_PDU             *DCI_pdu   = &eNB_mac_inst[module_idP].common_channels[CC_id].DCI_pdu;
+  int                  i;
+  DCI0_5MHz_TDD_1_6_t *ULSCH_dci = NULL;;
+
+  if (mac_xface->lte_frame_parms->frame_type == TDD) {
+    for (i=0;i<DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci;i++) {
+      ULSCH_dci = (DCI0_5MHz_TDD_1_6_t *)DCI_pdu->dci_alloc[i].dci_pdu;
+      if ((DCI_pdu->dci_alloc[i].format == format0) && (DCI_pdu->dci_alloc[i].rnti == rnti))
+	ULSCH_dci->dai = (dai-1)&3;
+    }
+  }
+  //  printf("Update UL DCI: DAI %d\n",dai);
+}
+
+
+void set_ue_dai(sub_frame_t   subframeP,
+	     uint8_t       tdd_config,
+	     int           UE_id,
+	     uint8_t       CC_id,
+	     UE_list_t     *UE_list) {
+  
+  switch (tdd_config) {
+  case 0:
+    if ((subframeP==0)||(subframeP==1)||(subframeP==3)||(subframeP==5)||(subframeP==6)||(subframeP==8))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+  case 1:
+    if ((subframeP==0)||(subframeP==4)||(subframeP==5)||(subframeP==9))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    break;
+  case 2:
+    if ((subframeP==4)||(subframeP==5))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    break;
+  case 3:
+    if ((subframeP==5)||(subframeP==7)||(subframeP==9))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    break;
+  case 4:
+    if ((subframeP==0)||(subframeP==6))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    break;
+  case 5:
+    if (subframeP==9)
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    break;
+  case 6:
+    if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6)||(subframeP==9))
+      UE_list->UE_template[CC_id][UE_id].DAI = 0;
+  default:
+    UE_list->UE_template[CC_id][UE_id].DAI = 0;
+    LOG_N(MAC,"unknow TDD config %d\n",tdd_config);
+    break;
+  }
+}	
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index 023dd4e11e0fc9710f0865ff59d57228079a8a2c..e1f5b613955220be6799752153263e8ff15faa4c 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -72,13 +72,13 @@
  extern inline unsigned int taus(void);
 
 #ifdef Rel10
-int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area){
+int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area){
   // currently there is one-to-one mapping between sf allocation pattern and sync area
   if (mbsfn_sync_area > MAX_MBSFN_AREA){
       LOG_W(MAC,"[eNB %d] MBSFN synchronization area %d out of range\n ", module_idP, mbsfn_sync_area);
       return -1;
   }
-  else if (eNB_mac_inst[module_idP].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL)
+  else if (eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL)
     return mbsfn_sync_area;
   else {
       LOG_W(MAC,"[eNB %d] MBSFN Subframe Config pattern %d not found \n ", module_idP, mbsfn_sync_area);
@@ -86,12 +86,12 @@ int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area){
   }
 }
 
-int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
+int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP) {
 
   int mcch_flag=0,mtch_flag=0, msi_flag=0;
   int mbsfn_period =0;// 1<<(eNB_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod);
   int mcch_period = 0;//32<<(eNB_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
-  int mch_scheduling_period = 8<<(eNB_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9);
+  int mch_scheduling_period = 8<<(eNB_mac_inst[module_idP].common_channels[CC_id].pmch_Config[0]->mch_SchedulingPeriod_r9);
   unsigned char mcch_sdu_length;
   unsigned char header_len_mcch=0,header_len_msi=0,header_len_mtch=0, header_len_mtch_temp=0, header_len_mcch_temp=0, header_len_msi_temp=0;
   int ii=0, msi_pos=0;
@@ -104,24 +104,24 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
   uint16_t sdu_lengths[11], sdu_length_total=0;
   unsigned char mch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; // check the max value, this is for dlsch only
 
-  eNB_mac_inst[module_idP].MCH_pdu.Pdu_size=0;
+  eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.Pdu_size=0;
 
   for (i=0;
-      i< eNB_mac_inst[module_idP].num_active_mbsfn_area;
+      i< eNB_mac_inst[module_idP].common_channels[CC_id].num_active_mbsfn_area;
       i++ ){
       // assume, that there is always a mapping
-      if ((j=get_mbsfn_sf_alloction(module_idP,i)) == -1)
+    if ((j=get_mbsfn_sf_alloction(module_idP,CC_id,i)) == -1)
         return 0;
 
-      mbsfn_period = 1<<(eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
-      mcch_period = 32<<(eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
+      mbsfn_period = 1<<(eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->radioframeAllocationPeriod);
+      mcch_period = 32<<(eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
       msi_pos=0; ii=0;
       LOG_D(MAC,"[eNB %d] Frame %d subframeP %d : Checking MBSFN Sync Area %d/%d with SF allocation %d/%d for MCCH and MTCH (mbsfn period %d, mcch period %d)\n",
-          module_idP,frameP, subframeP,i,eNB_mac_inst[module_idP].num_active_mbsfn_area,
-          j,eNB_mac_inst[module_idP].num_sf_allocation_pattern,mbsfn_period,mcch_period);
+          module_idP,frameP, subframeP,i,eNB_mac_inst[module_idP].common_channels[CC_id].num_active_mbsfn_area,
+          j,eNB_mac_inst[module_idP].common_channels[CC_id].num_sf_allocation_pattern,mbsfn_period,mcch_period);
 
 
-      switch (eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
+      switch (eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.signallingMCS_r9) {
       case 0:
         mcch_mcs = 2;
         break;
@@ -137,27 +137,27 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       }
 
       // 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist)
-      if (frameP %  mbsfn_period == eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset){ // MBSFN frameP
-          if (eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame){// one-frameP format
+      if (frameP %  mbsfn_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->radioframeAllocationOffset){ // MBSFN frameP
+          if (eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame){// one-frameP format
 
               //  Find the first subframeP in this MCH to transmit MSI
-              if (frameP % mch_scheduling_period == eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->radioframeAllocationOffset ) {
+              if (frameP % mch_scheduling_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->radioframeAllocationOffset ) {
                   while (ii == 0) {
-                      ii = eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80>>msi_pos);
+                      ii = eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & (0x80>>msi_pos);
                       msi_pos++;
                   }
-                  LOG_D(MAC,"[eNB %d] Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n", module_idP,frameP, subframeP,i,j,eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0], msi_pos);
+                  LOG_D(MAC,"[eNB %d] Frame %d subframeP %d : sync area %d sf allocation pattern %d sf alloc %x msi pos is %d \n", module_idP,frameP, subframeP,i,j,eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0], msi_pos);
               }
 
               // Check if the subframeP is for MSI, MCCH or MTCHs and Set the correspoding flag to 1
               switch (subframeP) {
               case 1:
                 if (mac_xface->lte_frame_parms->frame_type == FDD) {
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) {
                         if (msi_pos == 1)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF1) == MBSFN_FDD_SF1) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -166,11 +166,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 2:
                 if (mac_xface->lte_frame_parms->frame_type == FDD){
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) {
                         if (msi_pos == 2)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF2) == MBSFN_FDD_SF2) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -179,21 +179,21 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 3:
                 if (mac_xface->lte_frame_parms->frame_type == TDD){// TDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) {
                         if (msi_pos == 1)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF3) == MBSFN_TDD_SF3) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
                 }
                 else {// FDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) {
                         if (msi_pos == 3)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF3) == MBSFN_FDD_SF3) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -202,11 +202,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 4:
                 if (mac_xface->lte_frame_parms->frame_type == TDD){
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) {
                         if (msi_pos == 2)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF4) == MBSFN_TDD_SF4) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -215,11 +215,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 6:
                 if (mac_xface->lte_frame_parms->frame_type == FDD){
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) {
                         if (msi_pos == 4)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF6) == MBSFN_FDD_SF6) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -228,21 +228,21 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 7:
                 if (mac_xface->lte_frame_parms->frame_type == TDD){ // TDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) {
                         if (msi_pos == 3)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF7) == MBSFN_TDD_SF7) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
                 }
                 else {// FDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) {
                         if (msi_pos == 5)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF7) == MBSFN_FDD_SF7) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -251,21 +251,21 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 8:
                 if (mac_xface->lte_frame_parms->frame_type == TDD){ //TDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) {
                         if (msi_pos == 4)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF8) == MBSFN_TDD_SF8) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
                 }
                 else{ // FDD
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) {
                         if (msi_pos == 6)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_FDD_SF8) == MBSFN_FDD_SF8) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -274,11 +274,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
               case 9:
                 if (mac_xface->lte_frame_parms->frame_type == TDD){
-                    if ((eNB_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
+                    if ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_SubframeConfig[j]->subframeAllocation.choice.oneFrame.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) {
                         if (msi_pos == 5)
                           msi_flag = 1;
-                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
-                            ((eNB_mac_inst[module_idP].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) )
+                        if ( (frameP % mcch_period == eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_Offset_r9) &&
+                            ((eNB_mac_inst[module_idP].common_channels[CC_id].mbsfn_AreaInfo[i]->mcch_Config_r9.sf_AllocInfo_r9.buf[0] & MBSFN_TDD_SF9) == MBSFN_TDD_SF9) )
                           mcch_flag = 1;
                         mtch_flag = 1;
                     }
@@ -296,15 +296,15 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
           }
       }
   } // end of for loop
-  eNB_mac_inst[module_idP].msi_active=0;
-  eNB_mac_inst[module_idP].mcch_active=0;
-  eNB_mac_inst[module_idP].mtch_active=0;
+  eNB_mac_inst[module_idP].common_channels[CC_id].msi_active=0;
+  eNB_mac_inst[module_idP].common_channels[CC_id].mcch_active=0;
+  eNB_mac_inst[module_idP].common_channels[CC_id].mtch_active=0;
   // Calculate the mcs
   if ((msi_flag==1) || (mcch_flag==1)) {
-      eNB_mac_inst[module_idP].MCH_pdu.mcs = mcch_mcs;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcs = mcch_mcs;
   }
   else if (mtch_flag == 1) { // only MTCH in this subframeP
-      eNB_mac_inst[module_idP].MCH_pdu.mcs = eNB_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcs = eNB_mac_inst[module_idP].common_channels[CC_id].pmch_Config[0]->dataMCS_r9;
   }
 
 
@@ -328,9 +328,9 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       msi_ptr+= sizeof(MSI_ELEMENT);
 
       //Header for MTCHs
-      num_mtch = eNB_mac_inst[module_idP].mbms_SessionList[0]->list.count;
+      num_mtch = eNB_mac_inst[module_idP].common_channels[CC_id].mbms_SessionList[0]->list.count;
       for (k=0;k<num_mtch;k++) { // loop for all session in this MCH (MCH[0]) at this moment
-          ((MSI_ELEMENT *) msi_ptr)->lcid = eNB_mac_inst[module_idP].mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9;//mtch_lcid;
+          ((MSI_ELEMENT *) msi_ptr)->lcid = eNB_mac_inst[module_idP].common_channels[CC_id].mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9;//mtch_lcid;
           ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now)
           ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xB;
           msi_ptr+=sizeof(MSI_ELEMENT);
@@ -355,7 +355,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       sdu_length_total += sdu_lengths[num_sdus];
       LOG_I(MAC,"[eNB %d] Create %d bytes for MSI\n",module_idP,sdu_lengths[num_sdus]);
       num_sdus++;
-      eNB_mac_inst[module_idP].msi_active=1;
+      eNB_mac_inst[module_idP].common_channels[CC_id].msi_active=1;
   }
 
   // there is MCCH
@@ -366,7 +366,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       mcch_sdu_length = mac_rrc_data_req(module_idP,
           frameP,
           MCCH,1,
-          &eNB_mac_inst[module_idP].MCCH_pdu.payload[0],
+          &eNB_mac_inst[module_idP].common_channels[CC_id].MCCH_pdu.payload[0],
           1,// this is eNB
           module_idP, // index
           i); // this is the mbsfn sync area index
@@ -389,10 +389,10 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
                   mcch_sdu_length,
                   mcch_mcs);
           }
-          eNB_mac_inst[module_idP].mcch_active=1;
+          eNB_mac_inst[module_idP].common_channels[CC_id].mcch_active=1;
 
           memcpy((char *)&mch_buffer[sdu_length_total],
-              &eNB_mac_inst[module_idP].MCCH_pdu.payload[0],
+              &eNB_mac_inst[module_idP].common_channels[CC_id].MCCH_pdu.payload[0],
               mcch_sdu_length);
           sdu_lcids[num_sdus] = MCCH_LCHANID;
           sdu_lengths[num_sdus] = mcch_sdu_length;
@@ -403,7 +403,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
           num_sdus++;
       }
   }
-  TBS = mac_xface->get_TBS_DL(eNB_mac_inst[module_idP].MCH_pdu.mcs, mac_xface->lte_frame_parms->N_RB_DL);
+  TBS = mac_xface->get_TBS_DL(eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcs, mac_xface->lte_frame_parms->N_RB_DL);
 #ifdef Rel10
   // do not let mcch and mtch multiplexing when relaying is active
   // for sync area 1, so not transmit data
@@ -460,7 +460,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
               (char*)&mch_buffer[sdu_length_total]);
           //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO,  MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]);
           LOG_I(MAC,"[eNB %d][MBMS USER-PLANE] Got %d bytes for MTCH %d\n",module_idP,sdu_lengths[num_sdus],MTCH);
-          eNB_mac_inst[module_idP].mtch_active=1;
+          eNB_mac_inst[module_idP].common_channels[CC_id].mtch_active=1;
           sdu_lcids[num_sdus] = MTCH;
           sdu_length_total += sdu_lengths[num_sdus];
           if (sdu_lengths[num_sdus] < 128)
@@ -512,7 +512,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       }
       // Generate the MAC Header for MCH
       // here we use the function for DLSCH because DLSCH & MCH have the same Header structure
-      offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[module_idP].MCH_pdu.payload,
+      offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.payload,
           num_sdus,
           sdu_lengths,
           sdu_lcids,
@@ -522,25 +522,25 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
           padding,
           post_padding);
 
-      eNB_mac_inst[module_idP].MCH_pdu.Pdu_size=TBS;
-      eNB_mac_inst[module_idP].MCH_pdu.sync_area=i;
-      eNB_mac_inst[module_idP].MCH_pdu.msi_active= eNB_mac_inst[module_idP].msi_active;
-      eNB_mac_inst[module_idP].MCH_pdu.mcch_active= eNB_mac_inst[module_idP].mcch_active;
-      eNB_mac_inst[module_idP].MCH_pdu.mtch_active= eNB_mac_inst[module_idP].mtch_active;
-      LOG_D(MAC," MCS for this sf is %d (mcch active %d, mtch active %d)\n", eNB_mac_inst[module_idP].MCH_pdu.mcs,
-          eNB_mac_inst[module_idP].MCH_pdu.mcch_active,eNB_mac_inst[module_idP].MCH_pdu.mtch_active );
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.Pdu_size=TBS;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.sync_area=i;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.msi_active= eNB_mac_inst[module_idP].common_channels[CC_id].msi_active;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcch_active= eNB_mac_inst[module_idP].common_channels[CC_id].mcch_active;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mtch_active= eNB_mac_inst[module_idP].common_channels[CC_id].mtch_active;
+      LOG_D(MAC," MCS for this sf is %d (mcch active %d, mtch active %d)\n", eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcs,
+          eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcch_active,eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mtch_active );
       LOG_I(MAC,"[eNB %d][MBMS USER-PLANE ] Generate header : sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,padding %d,post_padding %d (mcs %d, TBS %d), header MTCH %d, header MCCH %d, header MSI %d\n",
-          module_idP,sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,padding,post_padding,eNB_mac_inst[module_idP].MCH_pdu.mcs,TBS,header_len_mtch, header_len_mcch, header_len_msi);
+          module_idP,sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,padding,post_padding,eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcs,TBS,header_len_mtch, header_len_mcch, header_len_msi);
       // copy SDU to mch_pdu after the MAC Header
-      memcpy(&eNB_mac_inst[module_idP].MCH_pdu.payload[offset],mch_buffer,sdu_length_total);
+      memcpy(&eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.payload[offset],mch_buffer,sdu_length_total);
       // filling remainder of MCH with random data if necessery
       for (j=0;j<(TBS-sdu_length_total-offset);j++)
-        eNB_mac_inst[module_idP].MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
+        eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
 
 #if defined(USER_MODE) && defined(OAI_EMU)
       /* Tracing of PDU is done on UE side */
       if (oai_emulation.info.opt_enabled)
-        trace_pdu(1, (uint8_t *)eNB_mac_inst[module_idP].MCH_pdu.payload,
+        trace_pdu(1, (uint8_t *)eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.payload,
             TBS, module_idP, 6, 0xffff,  // M_RNTI = 6 in wirehsark
             eNB_mac_inst[module_idP].subframe,0,0);
       LOG_D(OPT,"[eNB %d][MCH] Frame %d : MAC PDU with size %d\n",
@@ -553,11 +553,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
       return 1;
   }
   else {
-      eNB_mac_inst[module_idP].MCH_pdu.Pdu_size=0;
-      eNB_mac_inst[module_idP].MCH_pdu.sync_area=0;
-      eNB_mac_inst[module_idP].MCH_pdu.msi_active=0;
-      eNB_mac_inst[module_idP].MCH_pdu.mcch_active=0;
-      eNB_mac_inst[module_idP].MCH_pdu.mtch_active=0;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.Pdu_size=0;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.sync_area=0;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.msi_active=0;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mcch_active=0;
+      eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.mtch_active=0;
       // for testing purpose, fill with random data
       //for (j=0;j<(TBS-sdu_length_total-offset);j++)
       //  eNB_mac_inst[module_idP].MCH_pdu.payload[offset+sdu_length_total+j] = (char)(taus()&0xff);
@@ -573,10 +573,11 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
   return 0;
    */
 }
-MCH_PDU *get_mch_sdu(uint8_t module_idP,uint32_t frameP, sub_frame_t subframeP) {
+MCH_PDU *get_mch_sdu(uint8_t module_idP, uint8_t CC_id, uint32_t frameP, sub_frame_t subframeP) {
   //  eNB_mac_inst[module_idP].MCH_pdu.mcs=0;
   //LOG_D(MAC," MCH_pdu.mcs is %d\n", eNB_mac_inst[module_idP].MCH_pdu.mcs);
-  return(&eNB_mac_inst[module_idP].MCH_pdu);
+#warning "MCH pdu should take the CC_id index"
+  return(&eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu);
 }
 
 #endif
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 96e0e12af3a2f8995957a550e56a63735579a99e..ae74323e350b29c6d9eb4d671abd15f91de5a846 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -532,6 +532,30 @@ uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, uint32_t *rballoc) {
   return(rballoc_dci);
 }
 
+int get_min_rb_unit(module_id_t module_id, uint8_t CC_id){
+  
+  int min_rb_unit=0;
+  LTE_DL_FRAME_PARMS* frame_parms = mac_xface->get_lte_frame_parms(module_id,CC_id); 
+  switch (frame_parms->N_RB_DL) {
+  case 6: // 1.4 MHz
+    min_rb_unit=1;
+    break;
+  case 25: // 5HMz
+    min_rb_unit=2;
+    break;
+  case 50: // 10HMz
+    min_rb_unit=3;
+    break;
+  case 100: // 20HMz
+    min_rb_unit=4;
+    break;
+  default:
+    min_rb_unit=2;
+    LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n", module_id, CC_id);
+    break;
+  }
+  return min_rb_unit;
+}
 
 uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) {
 
@@ -539,23 +563,23 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) {
   uint32_t rballoc_dci=0;
   //uint8_t number_of_subbands=13;
 
-  LOG_T(MAC,"*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBGS %d)\n",
-      rballoc[3],rballoc[2],rballoc[1],rballoc[0],nb_rb,mac_xface->lte_frame_parms->N_RBGS);
-  while((nb_rb >0) && (check < mac_xface->lte_frame_parms->N_RBGS)){
+  LOG_T(MAC,"*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n",
+      rballoc[3],rballoc[2],rballoc[1],rballoc[0],nb_rb,mac_xface->lte_frame_parms->N_RBG);
+  while((nb_rb >0) && (check < mac_xface->lte_frame_parms->N_RBG)){
       //printf("rballoc[%d] %d\n",check,rballoc[check]);
       if(rballoc[check] == 1){
-          rballoc_dci |= (1<<((mac_xface->lte_frame_parms->N_RBGS-1)-check));
+          rballoc_dci |= (1<<((mac_xface->lte_frame_parms->N_RBG-1)-check));
           switch (mac_xface->lte_frame_parms->N_RB_DL) {
           case 6:
             nb_rb--;
           case 25:
-            if ((check == mac_xface->lte_frame_parms->N_RBGS-1))
+            if ((check == mac_xface->lte_frame_parms->N_RBG-1))
               nb_rb--;
             else
               nb_rb-=2;
             break;
           case 50:
-            if ((check == mac_xface->lte_frame_parms->N_RBGS-1))
+            if ((check == mac_xface->lte_frame_parms->N_RBG-1))
               nb_rb-=2;
             else
               nb_rb-=3;
@@ -576,21 +600,32 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) {
 }
 
 
+int get_nb_subband(void){
+ 
+  int nb_sb=0;
+
+  switch (mac_xface->lte_frame_parms->N_RB_DL) {
+  case 6:
+    nb_sb=0; 
+    break;
+  case 15:
+    nb_sb = 4;  // sb_size =4
+  case 25: 
+    nb_sb = 7; // sb_size =4, 1 sb with 1PRB, 6 with 2 RBG, each has 2 PRBs
+    break;
+  case 50:    // sb_size =6
+    nb_sb = 9;
+    break;
+  case 75:  // sb_size =8
+    nb_sb = 10;
+    break;
+  case 100: // sb_size =8 , 1 sb with 1 RBG + 12 sb with 2RBG, each RBG has 4 PRBs
+    nb_sb = 13;
+    break;
+  default:
+    nb_sb=0;
+    break;
+  }
+  return nb_sb;
 
-
-void update_ul_dci(module_id_t module_idP,int CC_id,rnti_t rnti,uint8_t dai) {
-
-  DCI_PDU             *DCI_pdu   = &eNB_mac_inst[module_idP].common_channels[CC_id].DCI_pdu;
-  int                  i;
-  DCI0_5MHz_TDD_1_6_t *ULSCH_dci = NULL;;
-
-  if (mac_xface->lte_frame_parms->frame_type == TDD) {
-      for (i=0;i<DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci;i++) {
-          ULSCH_dci = (DCI0_5MHz_TDD_1_6_t *)DCI_pdu->dci_alloc[i].dci_pdu;
-          if ((DCI_pdu->dci_alloc[i].format == format0) && (DCI_pdu->dci_alloc[i].rnti == rnti))
-            ULSCH_dci->dai = (dai-1)&3;
-      }
-  }
-  //  printf("Update UL DCI: DAI %d\n",dai);
 }
-
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 3ff6093711e3e82e33c1792ca22755424cb9c50a..5a363677db6a7b2e745b1dd086387a7e4ceb5903 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -582,7 +582,7 @@ void schedule_ulsch_rnti(module_id_t   module_idP,
 				    (UE_template->bsr_info[LCGID1]  == 0) &&
 				    (UE_template->bsr_info[LCGID2]  == 0) &&
 				    (UE_template->bsr_info[LCGID3] == 0))?
-		  BSR_TABLE[10] :   // This is when we've received SR and buffers are fully served
+		  BSR_TABLE[11] :   // This is when we've received SR and buffers are fully served
 		  BSR_TABLE[UE_template->bsr_info[LCGID0]]+
 		  BSR_TABLE[UE_template->bsr_info[LCGID1]]+
 		  BSR_TABLE[UE_template->bsr_info[LCGID2]]+
diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h
index d439c4de6d37b78912dd106d446315c804300fe1..dd353cc31f9453fa4678013b7eabd5aafcf0f3c4 100644
--- a/openair2/LAYER2/MAC/extern.h
+++ b/openair2/LAYER2/MAC/extern.h
@@ -86,6 +86,8 @@ extern EMULATION_VARS *Emul_vars;
 #endif //PHY_EMUL
 
 
+extern int cqi_to_mcs[16];
+
 extern uint32_t RRC_CONNECTION_FLAG;
 
 
diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c
index 40e85b9ad5158e6b98235b12b6ad7e2c559c88bb..e884c31816c1c437b761e3e762a001c46991604f 100644
--- a/openair2/LAYER2/MAC/main.c
+++ b/openair2/LAYER2/MAC/main.c
@@ -487,8 +487,14 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, uint8_t cba_group_
   mac_xface->phy_config_dedicated_eNB    = phy_config_dedicated_eNB;
   mac_xface->phy_config_dedicated_ue     = phy_config_dedicated_ue;
 
+  mac_xface->get_lte_frame_parms        = get_lte_frame_parms;
+  mac_xface->get_mu_mimo_mode           = get_mu_mimo_mode;
+
 #ifdef Rel10
   mac_xface->get_mch_sdu                 = get_mch_sdu;
+  mac_xface->phy_config_dedicated_scell_eNB= phy_config_dedicated_scell_eNB;
+  mac_xface->phy_config_dedicated_scell_ue= phy_config_dedicated_scell_ue;
+  
 #endif
 
   mac_xface->get_PHR = get_PHR;
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 659c6acd35d33ba6575c69e37940709baee11c55..b186bd97590f443d6004131b7a1d2a64cab2ed9f 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -36,7 +36,7 @@
 
  */
 
-
+#include "assertions.h"
 #include "PHY/defs.h"
 #include "PHY/extern.h"
 
@@ -70,7 +70,6 @@
 extern inline unsigned int taus(void);
 
 
-
 // This function stores the downlink buffer for all the logical channels 
 void store_dlsch_buffer (module_id_t Mod_id,
                          frame_t     frameP,
@@ -104,10 +103,12 @@ void store_dlsch_buffer (module_id_t Mod_id,
       UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
       UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
       UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
+      UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max, 
+							       rlc_status.head_sdu_creation_time );
       UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send;
       UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented;
-      UE_template->dl_buffer_total = UE_template->dl_buffer_total + UE_template->dl_buffer_info[i];//storing the total dlsch buffer
-      UE_template->dl_pdus_total += UE_template->dl_pdus_in_buffer[i];
+      UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer
+      UE_template->dl_pdus_total   += UE_template->dl_pdus_in_buffer[i];
       
 #ifdef DEBUG_eNB_SCHEDULER
       /* note for dl_buffer_head_sdu_remaining_size_to_send[i] :
@@ -124,18 +125,18 @@ void store_dlsch_buffer (module_id_t Mod_id,
 #endif
       
     }
-#ifdef DEBUG_eNB_SCHEDULER
+    //#ifdef DEBUG_eNB_SCHEDULER
     if ( UE_template->dl_buffer_total>0)
       LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n",
 	    Mod_id, frameP, subframeP, UE_id,
 	    UE_template->dl_buffer_total,
 	    UE_template->dl_pdus_total
 	    );
-#endif   
+    //#endif   
   }
 }
 
-
+ 
 // This function returns the estimated number of RBs required by each UE for downlink scheduling
 void assign_rbs_required (module_id_t Mod_id,
 			  frame_t     frameP,
@@ -149,76 +150,25 @@ void assign_rbs_required (module_id_t Mod_id,
   LTE_eNB_UE_stats *eNB_UE_stats[MAX_NUM_CCs];
   int              UE_id,n,i,j,CC_id,pCCid,tmp;
   UE_list_t        *UE_list = &eNB_mac_inst[Mod_id].UE_list;
-
+  UE_TEMPLATE           *UE_template;
+  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs];
 
   // clear rb allocations across all CC_ids
-
   for (UE_id=UE_list->head;UE_id>=0;UE_id=UE_list->next[UE_id]){
-
     pCCid = UE_PCCID(Mod_id,UE_id);
 
     //update CQI information across component carriers
     for (n=0;n<UE_list->numactiveCCs[UE_id];n++) {
 
       CC_id = UE_list->ordered_CCids[n][UE_id];
-
+      frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); 
       eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti);	
-
-      switch(eNB_UE_stats[CC_id]->DL_cqi[0]) {
-      case 0:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 0;
-	break;
-      case 1:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 0;
-	break;
-      case 2:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 0;
-	break;
-      case 3:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 2;
-	break;
-      case 4:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 4;
-	break;
-      case 5:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 6;
-	break;
-      case 6:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 8;
-	break;
-      case 7:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 11;
-	break;
-      case 8:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 13;
-	break;
-      case 9:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 16;
-	break;
-      case 10:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 18;
-	break;
-      case 11:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 20;
-	break;
-      case 12:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 22;
-	break;
-      case 13:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 25;
-	break;
-      case 14:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 27;
-	break;
-      case 15:
-	eNB_UE_stats[CC_id]->dlsch_mcs1 = 28;
-	break;
-      default:
-	LOG_E(MAC,"preprocessor.c assign_rbs_required(): Invalid CQI %d, should not happen",eNB_UE_stats[CC_id]->DL_cqi[0]);
-	exit(-1);
-      }
+      /*
+	DevCheck(((eNB_UE_stats[CC_id]->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats[CC_id]->DL_cqi[0] > MAX_CQI_VALUE)), 
+	eNB_UE_stats[CC_id]->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE);
+      */
+      eNB_UE_stats[CC_id]->dlsch_mcs1=cqi_to_mcs[eNB_UE_stats[CC_id]->DL_cqi[0]];
     }
-
     // provide the list of CCs sorted according to MCS
     for (i=0;i<UE_list->numactiveCCs[UE_id];i++) {
       for (j=i+1;j<UE_list->numactiveCCs[UE_id];j++) {
@@ -230,39 +180,43 @@ void assign_rbs_required (module_id_t Mod_id,
 	}
       }
     }
-  
-  
-
+    /*
     if ((mac_get_rrc_status(Mod_id,1,UE_id) < RRC_RECONFIGURED)){  // If we still don't have a default radio bearer
       nb_rbs_required[pCCid][UE_id] = PHY_vars_eNB_g[Mod_id][pCCid]->lte_frame_parms.N_RB_DL;
       continue;
     }
-
-    if (UE_list->UE_template[UE_id]->dl_buffer_total> 0) {
+    */ 
+    /* NN --> RK 
+     * check the index of UE_template"
+     */
+    //    if (UE_list->UE_template[UE_id]->dl_buffer_total> 0) { 
+    if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total> 0) { 
+      LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id);
       for (i=0;i<UE_list->numactiveCCs[UE_id];i++) {
 	CC_id = UE_list->ordered_CCids[i][UE_id];
-
+	LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id);
 	if (eNB_UE_stats[CC_id]->dlsch_mcs1==0) nb_rbs_required[CC_id][UE_id] = 4;  // don't let the TBS get too small
 	else nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id];
 	
 	TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]);
-	
+	/* calculating required number of RBs for each UE */
 	while (TBS < UE_list->UE_template[UE_id]->dl_buffer_total)  {
 	  nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id];
-	  if (nb_rbs_required[CC_id][UE_id]>PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL) {
-	    TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL);
-	    nb_rbs_required[CC_id][UE_id] = PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL;// calculating required number of RBs for each UE
+	  if (nb_rbs_required[CC_id][UE_id] > frame_parms[CC_id]->N_RB_DL) {
+	    TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,frame_parms[CC_id]->N_RB_DL);
+	    nb_rbs_required[CC_id][UE_id] = frame_parms[CC_id]->N_RB_DL;
 	    break;
 	  }
 	  TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]);
-	}
+	} // end of while 
+	LOG_D(MAC,"[eNB %d] Frame %d: UE %d on CC %d nb_required RB %d (TBS %d, mcs %d)\n", 
+	      Mod_id, frameP,UE_id, CC_id, nb_rbs_required[CC_id][UE_id], TBS, eNB_UE_stats[CC_id]->dlsch_mcs1);
       }
     }
   }
 }
 
 
-
 // This function scans all CC_ids for a particular UE to find the maximum round index of its HARQ processes
 
 int maxround(module_id_t Mod_id,uint16_t rnti,sub_frame_t subframe) {
@@ -341,33 +295,24 @@ void sort_UEs (module_id_t Mod_id,
 	//	for(j=0;j<MAX_NUM_LCID;j++){
 	//	  if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] < 
 	//      eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
-	  if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total < 
-	      UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total){
-	    swap_UEs(UE_list,UE_id1,UE_id2);
-	    //	    break;
-	  }
-	  else if (cqi1 < cqi2){
-	    swap_UEs(UE_list,UE_id1,UE_id2);
-	  }
 
-	    
-	    //	    if((j == MAX_NUM_LCID-1))
-	    //	    {
+	// first check the buffer status for SRB1 and SRB2 
 	
-	      /* The goal is to sort by priority.
-	       * We use the priority of DTCH logical
-	       * channel.
-	       */
-	      /*if(eNB_mac_inst[Mod_id][CC_id].UE_sched_ctrl[UE_id1].priority[3]<eNB_mac_inst[Mod_id][CC_id].UE_sched_ctrl[UE_id2].priority[3])
-		{
-		UE_id_sorted[i] = UE_id2;
-		UE_id_sorted[ii] = UE_id1;
-		} //if the priority is the same then sort by CQI
-		else if(eNB_mac_inst[Mod_id][CC_id].UE_sched_ctrl[UE_id1].priority[3]==eNB_mac_inst[Mod_id][CC_id].UE_sched_ctrl[UE_id2].priority[3]){*/                     
-	    
-
-	      //}
-	    //	    }
+	if ( (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) < 
+	     (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])   ){
+	  swap_UEs(UE_list,UE_id1,UE_id2);
+	}
+	else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max < 
+		 UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max   ){
+	  swap_UEs(UE_list,UE_id1,UE_id2);
+	} 
+	else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total < 
+		 UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total   ){
+	  swap_UEs(UE_list,UE_id1,UE_id2);
+	}
+	else if (cqi1 < cqi2){
+	  swap_UEs(UE_list,UE_id1,UE_id2);
+	}
       }
     }
   }
@@ -382,11 +327,11 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 				    sub_frame_t   subframeP,
 				    uint8_t       dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
 				    uint16_t      pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-				    int           N_RBGS[MAX_NUM_CCs],
-				    unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBGS_MAX],
-				    int *mbsfn_flag){
+				    int           N_RBG[MAX_NUM_CCs],
+				    unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
+				    int           *mbsfn_flag){
 
-  unsigned char rballoc_sub[MAX_NUM_CCs][13],harq_pid=0,harq_pid1=0,harq_pid2=0,round=0,round1=0,round2=0,total_ue_count[MAX_NUM_CCs];
+  unsigned char rballoc_sub[MAX_NUM_CCs][13],harq_pid=0,harq_pid1=0,harq_pid2=0,round=0,round1=0,round2=0,total_ue_count;
   unsigned char MIMO_mode_indicator[MAX_NUM_CCs][13];
   int                     UE_id, UE_id2, i;
   uint16_t                ii,j;
@@ -400,50 +345,37 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
   LTE_eNB_UE_stats  *eNB_UE_stats2 = NULL;
   int                min_rb_unit[MAX_NUM_CCs];
 
-  int CC_id;
+  uint8_t CC_id;
   UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list;
-
-
+  LTE_DL_FRAME_PARMS   *frame_parms[MAX_NUM_CCs];
+  int rrc_status           = RRC_IDLE;
+  int transmission_mode = 0;
+  
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
 
     if (mbsfn_flag[CC_id]>0)  // If this CC is allocated for MBSFN skip it here
       continue;
-
-    switch (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL) {
-    case 6:
-      min_rb_unit[CC_id]=1;
-      break;
-    case 25:
-      min_rb_unit[CC_id]=2;
-      break;
-    case 50:
-      min_rb_unit[CC_id]=3;
-      break;
-    case 100:
-      min_rb_unit[CC_id]=4;
-      break;
-    default:
-      min_rb_unit[CC_id]=2;
-      break;
-    }
-
-    // Initialize scheduling information for all active UEs
+    
+    frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); 
+    min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id);
+    
     for (i=UE_list->head;i>=0;i=UE_list->next[i]) {
       UE_id = i;
-
-      nb_rbs_required[CC_id][UE_id] = 0;
-      dl_pow_off[CC_id][UE_id]  =2;
-      pre_nb_available_rbs[CC_id][UE_id] = 0;
-      nb_rbs_required_remaining[CC_id][UE_id] = 0;
-      for(j=0;j<N_RBGS[CC_id];j++)
-	{
-	  MIMO_mode_indicator[CC_id][j] = 2;
-	  rballoc_sub[CC_id][j] = 0;
-	  rballoc_sub_UE[CC_id][UE_id][j] = 0;
-	}
+      // Initialize scheduling information for all active UEs
+      dlsch_scheduler_pre_processor_reset(UE_id,
+					  CC_id,
+					  N_RBG[CC_id],
+					  dl_pow_off,
+					  nb_rbs_required,
+					  pre_nb_available_rbs,
+					  nb_rbs_required_remaining,
+					  rballoc_sub_UE,
+					  rballoc_sub,
+					  MIMO_mode_indicator);
+ 
     }
   }
-
+  
   // Store the DLSCH buffer for each logical channel
   store_dlsch_buffer (Mod_id,frameP,subframeP);
 
@@ -453,7 +385,7 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
   // Sorts the user on the basis of dlsch logical channel buffer and CQI
   sort_UEs (Mod_id,subframeP);
 
-
+  total_ue_count =0;
   // loop over all active UEs
   for (i=UE_list->head;i>=0;i=UE_list->next[i]) {
 
@@ -467,7 +399,6 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
     for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
       CC_id = UE_list->ordered_CCids[ii][UE_id];
 
-      total_ue_count[CC_id]=0;
       average_rbs_per_user[CC_id]=0;
 
 
@@ -476,9 +407,10 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 	nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
       //nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id];
       if (nb_rbs_required[CC_id][UE_id] > 0) {
-	total_ue_count[CC_id] = total_ue_count[CC_id] + 1;
+	total_ue_count = total_ue_count + 1;
       }
       
+          
   // hypotetical assignement
   /*
    * If schedule is enabled and if the priority of the UEs is modified
@@ -489,14 +421,17 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
    * per user by a coefficient which represents the degree of priority.
    */
 
-
-      if((total_ue_count[CC_id] > 0) && ( min_rb_unit[CC_id] * total_ue_count[CC_id] <= PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL ) )
-	average_rbs_per_user[CC_id] = (uint16_t) ceil(PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL/total_ue_count[CC_id]);
+      if (total_ue_count == 0) 
+	average_rbs_per_user[CC_id] = 0;
+      else if( (min_rb_unit[CC_id] * total_ue_count) <= (frame_parms[CC_id]->N_RB_DL) )
+	average_rbs_per_user[CC_id] = (uint16_t) ceil(frame_parms[CC_id]->N_RB_DL/total_ue_count);
       else 
 	average_rbs_per_user[CC_id] = min_rb_unit[CC_id];
     }
   }
 
+  // note: nb_rbs_required is assigned according to total_buffer_dl
+  // extend nb_rbs_required to capture per LCID RB required
   for(i=UE_list->head;i>=0;i=UE_list->next[i]){
     for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
       CC_id = UE_list->ordered_CCids[ii][UE_id];
@@ -508,7 +443,6 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
     }
   }
 
-
   //Allocation to UEs is done in 2 rounds,
   // 1st round: average number of RBs allocated to each UE
   // 2nd round: remaining RBs are allocated to high priority UEs
@@ -517,165 +451,69 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
     for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
       for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
 	CC_id = UE_list->ordered_CCids[ii][UE_id];
- 
+ 	
 	if(r1 == 0)
 	  nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i];
 	else  // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round
 	  nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i];
-      }
-    }
-    // retransmission in control channels
-    for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
-      UE_id = i;
-      for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
-	CC_id = UE_list->ordered_CCids[ii][UE_id];
-	
-
-	rnti = UE_RNTI(Mod_id,UE_id);
-	if(rnti == 0)
-	  continue;
-	mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,subframeP,&harq_pid,&round,0);
-	
-	if ((mac_get_rrc_status(Mod_id,1,UE_id) < RRC_RECONFIGURED) && (round >0)) {
-	  for(j=0;j<N_RBGS[CC_id];j++){
-	    
-	    if((rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0) && (nb_rbs_required_remaining[UE_id]>0)){
-	      
-	      rballoc_sub[CC_id][j] = 1;
-	      rballoc_sub_UE[CC_id][UE_id][j] = 1;
-	      
-	      MIMO_mode_indicator[CC_id][j] = 1;
-	      
-	      if(mac_xface->get_transmission_mode(Mod_id,CC_id,rnti)==5)
-		dl_pow_off[CC_id][UE_id] = 1;
-	      // if the total rb is odd
-	      if ((j == N_RBGS[CC_id]-1) &&
-		  ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		   (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))) {
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id]+1;
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id] - 1;
-	      }
-	      else {
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id];
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id];
-	      }
-	    }
-	  }
-	}
-      }
-    }
-
-
-    // retransmission in data channels
-
-    for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
-      UE_id = i;
-      for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
-	CC_id = UE_list->ordered_CCids[ii][UE_id];
 
-	rnti = UE_RNTI(Mod_id,UE_id);
-	if(rnti == 0)
-	  continue;
-	mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,subframeP,&harq_pid,&round,0);
+	LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d,  pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n", 
+	      r1, CC_id, i, 
+	      nb_rbs_required_remaining[CC_id][i],
+	      nb_rbs_required_remaining_1[CC_id][i], 
+	      nb_rbs_required[CC_id][i],
+	      pre_nb_available_rbs[CC_id][i],
+	      N_RBG[CC_id],
+	      min_rb_unit[CC_id]);
 	
-	if ((mac_get_rrc_status(Mod_id,1,UE_id) >= RRC_RECONFIGURED) && (round > 0)) {
-	  
-	  for(j=0;j<N_RBGS[CC_id];j++){
-	    
-	    if((rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0) && (nb_rbs_required_remaining[UE_id]>0)){
-	      
-	      rballoc_sub[CC_id][j] = 1;
-	      rballoc_sub_UE[CC_id][UE_id][j] = 1;
-	      
-	      MIMO_mode_indicator[CC_id][j] = 1;
-	      
-	      if(mac_xface->get_transmission_mode(Mod_id,CC_id,rnti)==5)
-		dl_pow_off[CC_id][UE_id] = 1;
-	      
-	      if((j == N_RBGS[CC_id]-1) &&
-		 ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		  (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))){
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id] + 1;
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id] - 1;
-	      }
-	      else {
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id];
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id];
-	      }
-	    }
-	  }
-	}
       }
     }
-      
-    // control channel in the 1st transmission
-
-    for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
-      UE_id = i;
-      for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
-	CC_id = UE_list->ordered_CCids[ii][UE_id];
-
-	
-	rnti = UE_RNTI(Mod_id,UE_id);
-	if(rnti == 0)
-	  continue;
-	mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,subframeP,&harq_pid,&round,0);
+  
+    if (total_ue_count > 0 ) {
+      for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
+	UE_id = i;
+	for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
+	  CC_id = UE_list->ordered_CCids[ii][UE_id];
 	
-	if ((mac_get_rrc_status(Mod_id,1,UE_id) < RRC_RECONFIGURED) && (round == 0)) {
-	  
+	  rnti = UE_RNTI(Mod_id,UE_id);
+	  // LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
+	  if(rnti == 0)
+	    continue;
+	  transmission_mode = mac_xface->get_transmission_mode(Mod_id,CC_id,rnti);
+	  mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,subframeP,&harq_pid,&round,0);
+	  rrc_status = mac_get_rrc_status(Mod_id,1,UE_id);
+	  /* 1st allocate for the retx */ 
 	  
+	  // retransmission in data channels 
+	  // control channel in the 1st transmission
+	  // data channel for all TM 
+	  LOG_D(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n ");
+	  dlsch_scheduler_pre_processor_allocate (Mod_id,
+						  UE_id, 
+						  CC_id,
+						  N_RBG[CC_id],
+						  transmission_mode,
+						  min_rb_unit[CC_id],
+						  frame_parms[CC_id]->N_RB_DL,
+						  dl_pow_off,
+						  nb_rbs_required,
+						  pre_nb_available_rbs,
+						  nb_rbs_required_remaining,
+						  rballoc_sub_UE,
+						  rballoc_sub,
+						  MIMO_mode_indicator);
 	  
+#ifdef TM5
+	// data chanel TM5: to be revisted 
+	if ((round == 0 )  &&
+	    (transmission_mode == 5)  && 
+	    (dl_pow_off[CC_id][UE_id] != 1)){
 	  
-	  for(j=0;j<N_RBGS[CC_id];j++){
-	    
-	    if((rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0) && (nb_rbs_required_remaining[CC_id][UE_id]>0)){
-	      
-	      rballoc_sub[CC_id][j] = 1;
-	      rballoc_sub_UE[CC_id][UE_id][j] = 1;
-	      
-	      MIMO_mode_indicator[CC_id][j] = 1;
-	      
-	      if(mac_xface->get_transmission_mode(Mod_id,CC_id,rnti)==5)
-		dl_pow_off[CC_id][UE_id] = 1;
-	      
-	      if((j == N_RBGS[CC_id]-1) &&
-		 ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		  (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))){
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id] + 1;
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id] - 1;
-	      }
-	      else {
-		nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id];
-		pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id];
-	      }
-	    }
-	  }
-	}
-      }
-    }
-
-
-    // data chanel TM5
-    for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
-      UE_id = i;
-      for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
-	CC_id = UE_list->ordered_CCids[ii][UE_id];
-
-
-	rnti1 = UE_RNTI(Mod_id,UE_id);
-	if(rnti1 == 0)
-	  continue;
-	
-	eNB_UE_stats1 = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti1);
-	
-	mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti1,subframeP,&harq_pid1,&round1,0);
-	
-	if ((mac_get_rrc_status(Mod_id,1,UE_id) >= RRC_RECONFIGURED) && (round1==0) && (mac_xface->get_transmission_mode(Mod_id,CC_id,rnti1)==5) && (dl_pow_off[CC_id][UE_id] != 1)) {
-	  
-	  
-	  for(j=0;j<N_RBGS[CC_id];j+=2){
+	  for(j=0;j<N_RBG[CC_id];j+=2) {
 	    
-	    if((((j == (N_RBGS[CC_id]-1))&& (rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0)) || ((j < (N_RBGS[CC_id]-1)) && (rballoc_sub[CC_id][j+1] == 0) && (rballoc_sub_UE[CC_id][UE_id][j+1] == 0))) && (nb_rbs_required_remaining[CC_id][UE_id]>0)){
+	    if( (((j == (N_RBG[CC_id]-1))&& (rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0))  || 
+		 ((j < (N_RBG[CC_id]-1)) && (rballoc_sub[CC_id][j+1] == 0) && (rballoc_sub_UE[CC_id][UE_id][j+1] == 0)) ) && 
+		(nb_rbs_required_remaining[CC_id][UE_id]>0)){
 	      
 	      for (ii = UE_list->next[i+1];ii >=0;ii=UE_list->next[ii]) {
 		
@@ -687,9 +525,14 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 		eNB_UE_stats2 = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti2);
 		mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti2,subframeP,&harq_pid2,&round2,0);
 		
-		if ((mac_get_rrc_status(Mod_id,1,UE_id2) >= RRC_RECONFIGURED) && (round2==0) && (mac_xface->get_transmission_mode(Mod_id,CC_id,rnti2)==5) && (dl_pow_off[CC_id][UE_id2] != 1)) {
+		if ((mac_get_rrc_status(Mod_id,1,UE_id2) >= RRC_RECONFIGURED) && 
+		    (round2==0) && 
+		    (mac_xface->get_transmission_mode(Mod_id,CC_id,rnti2)==5) && 
+		    (dl_pow_off[CC_id][UE_id2] != 1)) {
 		  
-		  if((((j == (N_RBGS[CC_id]-1)) && (rballoc_sub_UE[CC_id][UE_id2][j] == 0)) || ((j < (N_RBGS[CC_id]-1)) && (rballoc_sub_UE[CC_id][UE_id2][j+1] == 0))) && (nb_rbs_required_remaining[CC_id][UE_id2]>0)){
+		  if( (((j == (N_RBG[CC_id]-1)) && (rballoc_sub_UE[CC_id][UE_id2][j] == 0)) || 
+		       ((j < (N_RBG[CC_id]-1)) && (rballoc_sub_UE[CC_id][UE_id2][j+1] == 0))  ) && 
+		      (nb_rbs_required_remaining[CC_id][UE_id2]>0)){
 		    
 		    if((((eNB_UE_stats2->DL_pmi_single^eNB_UE_stats1->DL_pmi_single)<<(14-j))&0xc000)== 0x4000){ //MU-MIMO only for 25 RBs configuration
 		      
@@ -698,7 +541,7 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 		      rballoc_sub_UE[CC_id][UE_id2][j] = 1;
 		      MIMO_mode_indicator[CC_id][j] = 0;
 		      
-		      if (j< N_RBGS[CC_id]-1) {
+		      if (j< N_RBG[CC_id]-1) {
 			rballoc_sub[CC_id][j+1] = 1;
 			rballoc_sub_UE[CC_id][UE_id][j+1] = 1;
 			rballoc_sub_UE[CC_id][UE_id2][j+1] = 1;
@@ -709,9 +552,7 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 		      dl_pow_off[CC_id][UE_id2] = 0;
 		      
 		      
-		      
-		      
-		      if ((j == N_RBGS[CC_id]-1) &&
+		      if ((j == N_RBG[CC_id]-1) &&
 			  ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25) ||
 			   (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))){
 			nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id]+1;
@@ -730,93 +571,21 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 		  }
 		}
 	      }
-	      
-	    }
-	  }
-	}
-      }
-    }
-    // data channel for all TM
-
-    for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
-      for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
-	CC_id = UE_list->ordered_CCids[ii][UE_id];
-	UE_id = i;
-
-	rnti = UE_RNTI(Mod_id,UE_id);
-	if (rnti == 0)
-	  continue;
-	
-	mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,subframeP,&harq_pid,&round,0);
-	
-	if ((mac_get_rrc_status(Mod_id,1,UE_id) >= RRC_RECONFIGURED) && (round==0)) {
-	  
-	  
-	  for(j=0;j<N_RBGS[CC_id];j++){
-	    
-	    if((rballoc_sub[CC_id][j] == 0) && (rballoc_sub_UE[CC_id][UE_id][j] == 0) && (nb_rbs_required_remaining[CC_id][UE_id]>0)){
-	      
-	      
-	      switch (mac_xface->get_transmission_mode(Mod_id,CC_id,rnti)) {
-	      case 1:
-	      case 2:
-	      case 4:
-	      case 6:
-		rballoc_sub[CC_id][j] = 1;
-		rballoc_sub_UE[CC_id][UE_id][j] = 1;
-		
-		MIMO_mode_indicator[CC_id][j] = 1;
-		
-		if((j == N_RBGS[CC_id]-1) &&
-		   ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		    (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))){
-		  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id]+1;
-		  pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] +min_rb_unit[CC_id]-1;
-		}
-		else {
-		  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id];
-		  pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id];
-		}
-		
-		break;
-	      case 5:
-		if (dl_pow_off[CC_id][UE_id] != 0){
-		  
-		  dl_pow_off[CC_id][UE_id] = 1;
-		  
-		  rballoc_sub[CC_id][j] = 1;
-		  rballoc_sub_UE[CC_id][UE_id][j] = 1;
-		  
-		  MIMO_mode_indicator[CC_id][j] = 1;
-		  
-		  if((j == N_RBGS[CC_id]-1) &&
-		     ((PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 25)||
-		      (PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms.N_RB_DL == 50))){
-		    nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id]+1;
-		    pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id]-1;
-		  }
-		  else {
-		    nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit[CC_id];
-		    pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit[CC_id];
-		  }
-		}
-		break;
-	      default:
-		break;
-	      }
 	    }
 	  }
+	}  
+#endif 
 	}
       }
-    }
-  }
-
+    } // total_ue_count 
+  } // end of for for r1 and r2
+#ifdef TM5  
   // This has to be revisited!!!!
   for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
     i1=0;
     i2=0;
     i3=0;
-    for (j=0;j<N_RBGS[CC_id];j++){
+    for (j=0;j<N_RBG[CC_id];j++){
       if(MIMO_mode_indicator[CC_id][j] == 2)
 	i1 = i1+1;
       else if(MIMO_mode_indicator[CC_id][j] == 1)
@@ -824,21 +593,20 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
       else if(MIMO_mode_indicator[CC_id][j] == 0)
 	i3 = i3+1;
     }
-    
-    
-    if((i1 < N_RBGS[CC_id]) && (i2>0) && (i3==0))
+    if((i1 < N_RBG[CC_id]) && (i2>0) && (i3==0))
       PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions + 1;
     
-    if(i3 == N_RBGS[CC_id] && i1==0 && i2==0)
+    if(i3 == N_RBG[CC_id] && i1==0 && i2==0)
       PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions + 1;
     
-    if((i1 < N_RBGS[CC_id]) && (i3 > 0))
+    if((i1 < N_RBG[CC_id]) && (i3 > 0))
       PHY_vars_eNB_g[Mod_id][CC_id]->check_for_MUMIMO_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_MUMIMO_transmissions + 1;
     
     PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions = PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions + 1;
-    
-    
+	  	  
   }
+  
+#endif 
 
   for(i=UE_list->head; i>=0;i=UE_list->next[i]) {
     for (ii=0;ii<UE_num_active_CC(UE_list,UE_id);ii++) {
@@ -848,7 +616,7 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
       LOG_D(MAC,"******************Scheduling Information for UE%d ************************\n",UE_id);
       LOG_D(MAC,"dl power offset UE%d = %d \n",UE_id,dl_pow_off[CC_id][UE_id]);
       LOG_D(MAC,"***********RB Alloc for every subband for UE%d ***********\n",UE_id);
-      for(j=0;j<N_RBGS[CC_id];j++){
+      for(j=0;j<N_RBG[CC_id];j++){
 	//PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i];
 	LOG_D(MAC,"RB Alloc for UE%d and Subband%d = %d\n",UE_id,j,rballoc_sub_UE[CC_id][UE_id][j]);
       }
@@ -858,3 +626,80 @@ void dlsch_scheduler_pre_processor (module_id_t   Mod_id,
   }
 }
 
+
+void dlsch_scheduler_pre_processor_reset (int UE_id, 
+					  uint8_t  CC_id,
+					  int N_RBG,
+					  uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], 
+					  unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
+					  unsigned char rballoc_sub[MAX_NUM_CCs][13],
+					  unsigned char MIMO_mode_indicator[MAX_NUM_CCs][13]){
+  int i;
+  nb_rbs_required[CC_id][UE_id]=0;
+  pre_nb_available_rbs[CC_id][UE_id] = 0;
+  dl_pow_off[CC_id][UE_id] = 2;
+  nb_rbs_required_remaining[CC_id][UE_id] = 0;
+  for (i=0;i<N_RBG;i++){
+    rballoc_sub_UE[CC_id][UE_id][i] = 0;
+    rballoc_sub[CC_id][i] = 0;
+    MIMO_mode_indicator[CC_id][i] = 2; 
+  }
+}
+
+
+void dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
+					     int           UE_id, 
+					     uint8_t       CC_id,
+					     int           N_RBG,
+					     int           transmission_mode,
+					     int           min_rb_unit, 
+					     uint8_t       N_RB_DL,
+					     uint8_t       dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], 
+					     unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
+					     unsigned char rballoc_sub[MAX_NUM_CCs][13],
+					     unsigned char MIMO_mode_indicator[MAX_NUM_CCs][13]){
+  
+  int i;
+  
+  for(i=0;i<N_RBG;i++){
+   
+    if((rballoc_sub[CC_id][i] == 0)           && 
+       (rballoc_sub_UE[CC_id][UE_id][i] == 0) && 
+       (nb_rbs_required_remaining[UE_id]>0)   &&
+       (pre_nb_available_rbs[CC_id][UE_id] < nb_rbs_required[CC_id][UE_id])){
+      
+      // if this UE is not scheduled for TM5
+      if (dl_pow_off[CC_id][UE_id] != 0 )  {
+	
+	rballoc_sub[CC_id][i] = 1;
+	rballoc_sub_UE[CC_id][UE_id][i] = 1;
+	MIMO_mode_indicator[CC_id][i] = 1;
+	
+	if (transmission_mode == 5 )
+	  dl_pow_off[CC_id][UE_id] = 1;
+	
+	if ((i == N_RBG-1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) {
+	  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit+1;
+	  pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit - 1;
+	}
+	else {
+	  nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit;
+	  pre_nb_available_rbs[CC_id][UE_id] = pre_nb_available_rbs[CC_id][UE_id] + min_rb_unit;
+	}
+      } // dl_pow_off[CC_id][UE_id] ! = 0
+    }
+  } 
+  
+}
+
+
+
+
+ 
+
diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h
index 3791e631ec5d93e121f4bba20dc19d44844cb3f8..9593ddd06a402ea111f991fcff1b7c9a6e5941d0 100644
--- a/openair2/LAYER2/MAC/proto.h
+++ b/openair2/LAYER2/MAC/proto.h
@@ -68,14 +68,14 @@ void schedule_SI(module_id_t module_idP,frame_t frameP,unsigned int *nprb,unsign
 @param frame Frame index
 @param subframe Subframe number on which to act
 */
-int schedule_MBMS(module_id_t module_idP,frame_t frameP, sub_frame_t subframe);
+int schedule_MBMS(module_id_t module_idP,uint8_t CC_id, frame_t frameP, sub_frame_t subframe);
 
 /** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
 @param Mod_id Instance ID of eNB
 @param mbsfn_sync_area index of mbsfn sync area
 @param[out] index of sf pattern 
 */
-int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area);
+int8_t get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area);
 
 /** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
 @param Mod_id Instance ID of eNB
@@ -170,6 +170,16 @@ void mac_top_cleanup(void);
 
 void mac_UE_out_of_sync_ind(module_id_t module_idP,frame_t frameP, uint16_t eNB_index);
 
+void dlsch_scheduler_pre_processor_reset (int UE_id, 
+					  uint8_t  CC_id,
+					  int N_RBG,
+					  uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					  uint16_t  nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], 
+					  unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
+					  unsigned char rballoc_sub[MAX_NUM_CCs][13],
+					  unsigned char MIMO_mode_indicator[MAX_NUM_CCs][13]);
 
 // eNB functions
 /* \brief This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done
@@ -188,10 +198,26 @@ void dlsch_scheduler_pre_processor (module_id_t module_idP,
                                     sub_frame_t subframe,
                                     uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
                                     uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
-                                    int N_RBGS[MAX_NUM_CCs],
-                                    unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBGS_MAX],
+                                    int N_RBG[MAX_NUM_CCs],
+                                    unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
 				    int *mbsfn_flag);
 
+
+void dlsch_scheduler_pre_processor_allocate (module_id_t   Mod_id,
+					     int           UE_id, 
+					     uint8_t       CC_id,
+					     int           N_RBG,
+					     int           transmission_mode,
+					     int           min_rb_unit, 
+					     uint8_t       N_RB_DL,
+					     uint8_t       dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+					     uint16_t      nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], 
+					     unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX],
+					     unsigned char rballoc_sub[MAX_NUM_CCs][13],
+					     unsigned char MIMO_mode_indicator[MAX_NUM_CCs][13]);
+
 /* \brief Function to trigger the eNB scheduling procedure.  It is called by PHY at the beginning of each subframe, \f$n$\f 
    and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. The resultant DCI_PDU is
    ready after returning from this call.
@@ -268,7 +294,7 @@ uint8_t *get_dlsch_sdu(module_id_t module_idP,int CC_id,frame_t frameP,rnti_t rn
 @param mcs Pointer to mcs used by PHY (to be filled by MAC) 
 @returns Pointer to MCH transport block and mcs for subframe
 */
-MCH_PDU *get_mch_sdu(uint8_t Mod_id,uint32_t frame,sub_frame_t subframe);
+MCH_PDU *get_mch_sdu(uint8_t Mod_id,uint8_t CC_id, uint32_t frame,sub_frame_t subframe);
 
 
 //added for ALU icic purpose
@@ -291,6 +317,12 @@ uint8_t     process_ue_cqi    (module_id_t module_idP, int UE_id);
 
 int8_t find_active_UEs_with_traffic(module_id_t module_idP);
 
+void set_ue_dai(sub_frame_t   subframeP,
+		uint8_t       tdd_config,
+		int           UE_id,
+		uint8_t       CC_id,
+		UE_list_t     *UE_list);
+
 uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id);
 uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id);
 /** \brief Round-robin scheduler for ULSCH traffic.
@@ -340,7 +372,7 @@ void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t CH_ind
 void ue_decode_si(module_id_t module_idP, int CC_id,frame_t frame, uint8_t CH_index, void *pdu, uint16_t len);
 
 
-void ue_send_sdu(module_id_t module_idP, int CC_id,frame_t frame, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
+void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frame, uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
 
 
 #ifdef Rel10
@@ -352,7 +384,7 @@ void ue_send_sdu(module_id_t module_idP, int CC_id,frame_t frame, uint8_t *sdu,u
 @param eNB_index Index of attached eNB
 @param sync_area the index of MBSFN sync area
 */
-void ue_send_mch_sdu(module_id_t module_idP,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area) ;
+void ue_send_mch_sdu(module_id_t module_idP,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area) ;
 
 /*\brief Function to check if UE PHY needs to decode MCH for MAC.
 @param Mod_id Index of protocol instance
@@ -362,7 +394,7 @@ void ue_send_mch_sdu(module_id_t module_idP,frame_t frameP,uint8_t *sdu,uint16_t
 @param[out] sync_area return the sync area
 @param[out] mcch_active flag indicating whether this MCCH is active in this SF
 */
-int ue_query_mch(uint8_t Mod_id,uint32_t frame,sub_frame_t subframe, uint8_t eNB_index, uint8_t *sync_area, uint8_t *mcch_active);
+int ue_query_mch(uint8_t Mod_id,uint8_t CC_id, uint32_t frame,sub_frame_t subframe, uint8_t eNB_index, uint8_t *sync_area, uint8_t *mcch_active);
 
 #endif
 
@@ -447,6 +479,12 @@ int mac_init(void);
 int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti);
 int mac_remove_ue(module_id_t Mod_id, int UE_id);
 
+void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP);
+int prev(UE_list_t *listP, int nodeP);
+int UE_num_active_CC(UE_list_t *listP,int ue_idP);
+int UE_PCCID(module_id_t mod_idP,int ue_idP);
+rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
+
 /*! \fn  UE_L2_state_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframe, lte_subframe_t direction,uint8_t eNB_index)
    \brief UE scheduler where all the ue background tasks are done.  This function performs the following:  1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.  
 \param[in] module_idP instance of the UE
@@ -609,5 +647,9 @@ void add_common_dci(DCI_PDU *DCI_pdu,
 
 uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc);
 
-void update_ul_dci(module_id_t module_idP,int CC_id,rnti_t rnti,uint8_t dai);
+void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai);
+
+int get_min_rb_unit(module_id_t module_idP, uint8_t CC_id);
+
+
 #endif
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 055c93d97b8064955a20a0416a78bd986ecd88a6..c59300d8e0a564763d7e65e7211a0215cd9602fa 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -274,7 +274,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i
   }
 }
 
-void ue_send_sdu(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index) {
+void ue_send_sdu(module_id_t module_idP, uint8_t CC_id,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index) {
 
   unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
   unsigned char rx_lcids[NB_RB_MAX];
@@ -489,7 +489,7 @@ unsigned char *parse_mch_header(unsigned char *mac_header,
 }
 
 // this function is for sending mch_sdu from phy to mac
-void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, uint8_t *sdu, uint16_t sdu_len, uint8_t eNB_index, uint8_t sync_area) {
+void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint8_t *sdu, uint16_t sdu_len, uint8_t eNB_index, uint8_t sync_area) {
 
   unsigned char num_sdu, i, *payload_ptr;
   unsigned char rx_lcids[NB_RB_MAX];
@@ -570,7 +570,7 @@ int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_are
   }
 }
 
-int ue_query_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active) {
+int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_t subframe, uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active) {
 
   int i=0, j=0, ii=0, msi_pos=0, mcch_mcs = - 1;
   int mcch_flag=0, mtch_flag=0, msi_flag=0;
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 82228698775e59dfddcab98e2b4157f3ff15773c..6e1e3409b5ffcff595117cf257f50f2e1de6a618 100755
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -155,7 +155,9 @@ boolean_t pdcp_data_req(
     start_meas(&eNB_pdcp_stats[enb_mod_idP].data_req);
   else
     start_meas(&UE_pdcp_stats[ue_mod_idP].data_req);
-
+ 
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN);
+   
   // PDCP transparent mode for MBMS traffic
 
   if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
@@ -230,6 +232,7 @@ boolean_t pdcp_data_req(
                     stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req);
                   else
                     stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req);
+		  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
                   return FALSE;
               }
           } else {
@@ -243,6 +246,7 @@ boolean_t pdcp_data_req(
                     stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req);
                   else
                     stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req);
+		  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
                   return FALSE;
               }
           }
@@ -258,6 +262,7 @@ boolean_t pdcp_data_req(
                 stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req);
               else
                 stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req);
+	      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
               return FALSE;
           }
 
@@ -317,7 +322,8 @@ boolean_t pdcp_data_req(
             ue_mod_idP,
             rb_idP);
 #endif
-          return FALSE;
+	vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
+	return FALSE;
       }
       /*
        * Ask sublayer to transmit data and check return value
@@ -376,6 +382,7 @@ boolean_t pdcp_data_req(
       Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
     }
     }*/
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
   return ret;
 
 }
@@ -402,10 +409,7 @@ boolean_t pdcp_data_ind(
   uint8_t      payload_offset  = 0;
   rb_id_t      rb_id           = rb_idP;
 
-  if (enb_flagP)
-    start_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
-  else
-    start_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
+ 
 
 #ifdef OAI_EMU
   if (enb_flagP) {
@@ -484,17 +488,19 @@ boolean_t pdcp_data_ind(
 
       }
   }
-
+  
   sdu_list_p = &pdcp_sdu_list;
 
   if (sdu_buffer_sizeP == 0) {
       LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!\n");
-      if (enb_flagP)
-	stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
-      else
-	stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
       return FALSE;
   }
+  
+  if (enb_flagP)
+    start_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
+  else
+    start_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);  
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
 
   /*
    * Parse the PDU placed at the beginning of SDU to check
@@ -531,6 +537,7 @@ boolean_t pdcp_data_ind(
             stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
           else
             stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
+	  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
           return FALSE;
       }
   
@@ -591,6 +598,7 @@ boolean_t pdcp_data_ind(
 	stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
       else
 	stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
+      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
       return TRUE;
     }
   /*
@@ -649,7 +657,8 @@ boolean_t pdcp_data_ind(
              stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
            else
              stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
-           return TRUE;
+	   vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
+	   return TRUE;
       }
   }
 #else
@@ -660,6 +669,7 @@ boolean_t pdcp_data_ind(
 	stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
       else
 	stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
+      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
       return TRUE;
   }
 #endif
@@ -739,6 +749,7 @@ boolean_t pdcp_data_ind(
     stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
   else
     stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind);
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
   return TRUE;
 }
 
@@ -871,12 +882,13 @@ void pdcp_run (
   else
     stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_ip);
 
-  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
   if (enb_flagP)
     stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run);
   else
     stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_run);
 
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
+
 }
 
 boolean_t rrc_pdcp_config_asn1_req (
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index 67fb2fb092393863fb430b45c03fe7bb81551cd1..304beb787b04b332303c9847996ca8991dd6a287 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -39,6 +39,7 @@
 #include "../MAC/extern.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/OCG/OCG_vars.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
 
 #include "assertions.h"
 
@@ -407,6 +408,8 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
   DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
 #endif
 
+  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_IN);
+
 #ifdef Rel10
   if (MBMS_flagP == TRUE) {
       if (enb_flagP) {
@@ -451,6 +454,7 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
                     enb_module_idP,
                     ue_module_idP,
                     rb_idP);
+	      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
               return RLC_OP_STATUS_BAD_PARAMETER;
 
           case RLC_MODE_AM:
@@ -486,8 +490,10 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
                           rb_idP);
                   LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
                   rlc_am_data_req(&rlc_union_p->rlc.am, frameP, new_sdu_p);
+		  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                   return RLC_OP_STATUS_OK;
               } else {
+		vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                   return RLC_OP_STATUS_INTERNAL_ERROR;
               }
               break;
@@ -522,9 +528,11 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
                   rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p);
 
                   //free_mem_block(new_sdu);
+		  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                   return RLC_OP_STATUS_OK;
               } else {
-                  return RLC_OP_STATUS_INTERNAL_ERROR;
+		vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+		return RLC_OP_STATUS_INTERNAL_ERROR;
               }
               break;
 
@@ -555,15 +563,18 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
                                  rb_idP);
                   LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
                   rlc_tm_data_req(&rlc_union_p->rlc.tm, new_sdu_p);
+		  vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                   return RLC_OP_STATUS_OK;
               } else {
                   //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
-                  return RLC_OP_STATUS_INTERNAL_ERROR;
+		vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+		return RLC_OP_STATUS_INTERNAL_ERROR;
               }
               break;
 
           default:
               free_mem_block(sdu_pP);
+	      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
               return RLC_OP_STATUS_INTERNAL_ERROR;
 
       }
@@ -598,14 +609,18 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
                       rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p);
 
                       //free_mem_block(new_sdu);
+		      vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                       return RLC_OP_STATUS_OK;
                   } else {
+		    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                       return RLC_OP_STATUS_BAD_PARAMETER;
                   }
               } else {
+		vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
                   return RLC_OP_STATUS_BAD_PARAMETER;
               }
           } else {
+	    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
               return RLC_OP_STATUS_BAD_PARAMETER;
           }
   }
@@ -614,6 +629,7 @@ rlc_op_status_t rlc_data_req     (const module_id_t  enb_module_idP,
     free_mem_block(sdu_pP);
     LOG_E(RLC, "MBMS_flag != 0 while Rel10 is not defined...\n");
     //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP);
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
     return RLC_OP_STATUS_BAD_PARAMETER;
   }
 #endif
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index 2d227ee244e3793a8bab0727a2c5591162c5aa46..a8a3271194ef6965a1758a59f4b2acc8cd30eb06 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -42,6 +42,7 @@
 #include "UTIL/OCG/OCG_vars.h"
 #include "hashtable.h"
 #include "assertions.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
 
 #define DEBUG_MAC_INTERFACE 1
 
@@ -130,8 +131,7 @@ tbs_size_t mac_rlc_data_req(
     hash_key_t             key             = HASHTABLE_QUESTIONABLE_KEY_VALUE;
     hashtable_rc_t         h_rc;
     srb_flag_t             srb_flag        = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
-
-
+    tbs_size_t             ret_tb_size         = 0;
 #ifdef DEBUG_MAC_INTERFACE
     LOG_D(RLC, "\n[RLC] Inst %s enb id %d ue id %d: MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d, Num_tb %d\n",
                (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP, channel_idP, RLC_MAX_LC, NB_RB_MAX);
@@ -168,6 +168,7 @@ tbs_size_t mac_rlc_data_req(
             oai_emulation.info.first_ue_local);
     }
 #endif 
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_IN);
 
     if (MBMS_flagP) {
         if (enb_flagP) {
@@ -195,25 +196,27 @@ tbs_size_t mac_rlc_data_req(
 
     switch (rlc_mode) {
         case RLC_MODE_NONE:
-        break;
+	  ret_tb_size =0;
+	  break;
 
         case RLC_MODE_AM:
             data_request = rlc_am_mac_data_request(&rlc_union_p->rlc.am, frameP);
-            return mac_rlc_serialize_tb(buffer_pP, data_request.data);
-            break;
+            ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
+	    break;
 
         case RLC_MODE_UM:
             data_request = rlc_um_mac_data_request(&rlc_union_p->rlc.um, frameP);
-            return mac_rlc_serialize_tb(buffer_pP, data_request.data);
+            ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data);
             break;
 
         case RLC_MODE_TM:
             data_request = rlc_tm_mac_data_request(&rlc_union_p->rlc.tm, frameP);
-            return mac_rlc_serialize_tb(buffer_pP, data_request.data);
-            break;
+            ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data);
+	    break;
         default:;
-    }
-    return (tbs_size_t)0;
+    }  
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+    return ret_tb_size;
 }
 //-----------------------------------------------------------------------------
 void mac_rlc_data_ind     (
@@ -282,6 +285,9 @@ void mac_rlc_data_ind     (
             oai_emulation.info.first_ue_local);
     }
 #endif
+    
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN);
+    
     if (MBMS_flagP) {
         if (BOOL_NOT(enb_flagP)) {
             mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[enb_module_idP][channel_idP];
@@ -332,6 +338,9 @@ void mac_rlc_data_ind     (
             rlc_tm_mac_data_indication(&rlc_union_p->rlc.tm, frameP, enb_flagP, data_ind);
             break;
     }
+    
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_OUT);
+   
 }
 //-----------------------------------------------------------------------------
 mac_rlc_status_resp_t mac_rlc_status_ind(
@@ -399,7 +408,9 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
             oai_emulation.info.first_ue_local);
     }
 #endif
-
+    
+ vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_IN);
+ 
 
     if (MBMS_flagP) {
         if (enb_flagP) {
@@ -428,7 +439,8 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
     switch (rlc_mode) {
         case RLC_MODE_NONE:
             //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
-            break;
+	   mac_rlc_status_resp.bytes_in_buffer                 = 0;
+           break;
 
         case RLC_MODE_AM:
             status_resp = rlc_am_mac_status_indication(&rlc_union_p->rlc.am, frameP, tb_sizeP, tx_status);
@@ -436,7 +448,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
             mac_rlc_status_resp.head_sdu_creation_time          = status_resp.head_sdu_creation_time;
             mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
             mac_rlc_status_resp.head_sdu_is_segmented           = status_resp.head_sdu_is_segmented;
-            return mac_rlc_status_resp;
+	    //return mac_rlc_status_resp;
             break;
 
         case RLC_MODE_UM:
@@ -446,18 +458,21 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
             mac_rlc_status_resp.head_sdu_creation_time          = status_resp.head_sdu_creation_time;
             mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
             mac_rlc_status_resp.head_sdu_is_segmented           = status_resp.head_sdu_is_segmented;
-            return mac_rlc_status_resp;
+	    //   return mac_rlc_status_resp;
             break;
 
         case RLC_MODE_TM:
             status_resp = rlc_tm_mac_status_indication(&rlc_union_p->rlc.tm, frameP, tb_sizeP, tx_status);
             mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
             mac_rlc_status_resp.pdus_in_buffer  = status_resp.buffer_occupancy_in_pdus;
-            return mac_rlc_status_resp;
+	    // return mac_rlc_status_resp;
             break;
 
-        default:;
+        default:
+	  mac_rlc_status_resp.bytes_in_buffer                 = 0 ;
     }
+    
+    vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_OUT);
     return mac_rlc_status_resp;
 }
 
diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c
index 559d571e3b557de76e0b63b8f2a54a8c4f7e71b6..9c7840138545fe3861dc20e6309044db2958a4cf 100644
--- a/openair2/LAYER2/openair2_proc.c
+++ b/openair2/LAYER2/openair2_proc.c
@@ -85,28 +85,29 @@ int dump_eNB_l2_stats(char *buffer, int length){
     /* reset the values */ 
     eNB = &eNB_mac_inst[eNB_id];
     UE_list = &eNB->UE_list;
-
-    eNB->eNB_stats.dlsch_bitrate= 0; 
-    
-    len += sprintf(&buffer[len],"eNB %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d \n",
-		   eNB_id, eNB->frame,
-		   eNB->eNB_stats.num_dlactive_UEs,
-		   eNB->eNB_stats.available_prbs,
-		   eNB->eNB_stats.available_ncces);
     
-    eNB->eNB_stats.dlsch_bitrate=((eNB->eNB_stats.dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
-    eNB->eNB_stats.total_dlsch_pdus_tx+=eNB->eNB_stats.dlsch_pdus_tx;
-    eNB->eNB_stats.total_dlsch_bytes_tx+=eNB->eNB_stats.dlsch_bytes_tx;
-    eNB->eNB_stats.total_dlsch_bitrate=((eNB->eNB_stats.total_dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
-       
-    len += sprintf(&buffer[len],"DLSCH bitrate (TTI %u, avg %u) kbps, Transmitted bytes (TTI %u, total %u), Transmitted PDU (TTI %u, total %u) \n",
-		   eNB->eNB_stats.dlsch_bitrate,
-		   eNB->eNB_stats.total_dlsch_bitrate,
-		   eNB->eNB_stats.dlsch_bytes_tx,
-		   eNB->eNB_stats.total_dlsch_bytes_tx,
-		   eNB->eNB_stats.dlsch_pdus_tx,
-		   eNB->eNB_stats.total_dlsch_pdus_tx);
+    for (CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
+      eNB->eNB_stats[CC_id].dlsch_bitrate= 0; 
     
+      len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d \n",
+		     eNB_id, CC_id, eNB->frame,
+		     eNB->eNB_stats[CC_id].num_dlactive_UEs,
+		     eNB->eNB_stats[CC_id].available_prbs,
+		     eNB->eNB_stats[CC_id].available_ncces);
+      
+      eNB->eNB_stats[CC_id].dlsch_bitrate=((eNB->eNB_stats[CC_id].dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
+      eNB->eNB_stats[CC_id].total_dlsch_pdus_tx+=eNB->eNB_stats[CC_id].dlsch_pdus_tx;
+      eNB->eNB_stats[CC_id].total_dlsch_bytes_tx+=eNB->eNB_stats[CC_id].dlsch_bytes_tx;
+      eNB->eNB_stats[CC_id].total_dlsch_bitrate=((eNB->eNB_stats[CC_id].total_dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
+      
+      len += sprintf(&buffer[len],"DLSCH bitrate (TTI %u, avg %u) kbps, Transmitted bytes (TTI %u, total %u), Transmitted PDU (TTI %u, total %u) \n",
+		     eNB->eNB_stats[CC_id].dlsch_bitrate,
+		     eNB->eNB_stats[CC_id].total_dlsch_bitrate,
+		     eNB->eNB_stats[CC_id].dlsch_bytes_tx,
+		     eNB->eNB_stats[CC_id].total_dlsch_bytes_tx,
+		     eNB->eNB_stats[CC_id].dlsch_pdus_tx,
+		     eNB->eNB_stats[CC_id].total_dlsch_pdus_tx);
+    }
     len += sprintf(&buffer[len],"\n");
 
     for (UE_id=UE_list->head;UE_id>0;UE_id=UE_list->next[UE_id]) {
diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h
index e01c0c4355750ceda272ba78243a59749235befe..7412c4b0a5bc78981c7fd48998b32c568c8984d2 100755
--- a/openair2/PHY_INTERFACE/defs.h
+++ b/openair2/PHY_INTERFACE/defs.h
@@ -117,15 +117,20 @@ typedef struct
     /// Configure Common PHY parameters from SIB13
     void (*phy_config_sib13_eNB)(module_id_t Mod_id,int CC_id, int mbsfn_Area_idx,
 				long mbsfn_AreaId_r9);
+
+    void (*phy_config_dedicated_scell_eNB)(uint8_t Mod_id,
+					   uint16_t rnti,
+					   SCellToAddMod_r10_t *sCellToAddMod_r10, 
+					   int CC_id);
 #endif
     
     /// PHY-Config-Dedicated eNB
-    void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti,
+      void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti,
 				     struct PhysicalConfigDedicated *physicalConfigDedicated);
 
 #ifdef Rel10
     /// Get MCH sdu and corresponding MCS for particular MBSFN subframe
-    MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe);
+    MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id, uint8_t CC_id, frame_t frameP,sub_frame_t subframe);
 #endif
     // configure the cba rnti at the physical layer 
     void (*phy_config_cba_rnti)(module_id_t Mod_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
@@ -142,15 +147,15 @@ typedef struct
     void (*ue_decode_si)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len);
 
     /// Send a received DLSCH sdu to MAC
-    void (*ue_send_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
+    void (*ue_send_sdu)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
 
 #ifdef Rel10
     /// Send a received MCH sdu to MAC
-    void (*ue_send_mch_sdu)(module_id_t Mod_id,frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area);
+    void (*ue_send_mch_sdu)(module_id_t Mod_id,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area);
 
     /// Function to check if UE PHY needs to decode MCH for MAC
-    /// get the sync area id, and teturn MCS value if need to decode, otherwise -1
-    int (*ue_query_mch)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
+    /// get the sync area id, and return MCS value if need to decode, otherwise -1
+    int (*ue_query_mch)(module_id_t Mod_id, uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
 #endif
 
   /// Retrieve ULSCH sdu from MAC
@@ -191,8 +196,13 @@ typedef struct
 
 #ifdef Rel10
     /// Configure Common PHY parameters from SIB13
-    void (*phy_config_sib13_ue)(uint8_t Mod_id,uint8_t CH_index,int mbsfn_Area_idx,
+    void (*phy_config_sib13_ue)(uint8_t Mod_id,int CC_id, uint8_t eNB_index,int mbsfn_Area_idx,
 				long mbsfn_AreaId_r9);
+
+    void (*phy_config_dedicated_scell_ue)(uint8_t Mod_id,
+				   uint8_t eNB_index,
+				    SCellToAddMod_r10_t *sCellToAddMod_r10, 
+				       int CC_id);
 #endif
     /// Configure Common PHY parameters from mobilityControlInfo
     void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CH_index,
@@ -200,19 +210,19 @@ typedef struct
 				  uint8_t ho_failed);
 
     /// Function to indicate failure of contention resolution or RA procedure
-    void (*ra_failed)(module_id_t Mod_id,int CC_id,uint8_t eNB_index);
+    void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
 
     /// Function to indicate success of contention resolution or RA procedure
-    void (*ra_succeeded)(module_id_t Mod_id,int CC_id, uint8_t eNB_index);
+    void (*ra_succeeded)(module_id_t Mod_id,uint8_t CC_id, uint8_t eNB_index);
 
     /// Function to indicate the transmission of msg1/rach to MAC
-    void (*Msg1_transmitted)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id);
+    void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
 
     /// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
-    void (*Msg3_transmitted)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id);
+    void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
 
     /// Function to pass inter-cell measurement parameters to PHY (cell Ids)
-    void (*phy_config_meas_ue)(module_id_t Mod_id,int CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id);
+    void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id);
 
     // PHY Helper Functions
 
@@ -226,22 +236,22 @@ typedef struct
     uint16_t (*get_TBS_UL)(uint8_t mcs, uint16_t nb_rb);
 
     /// Function to retrieve the HARQ round index for a particular UL/DLSCH and harq_pid
-    int (*get_ue_active_harq_pid)(module_id_t Mod_id, int CC_id,rnti_t rnti, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag);
+    int (*get_ue_active_harq_pid)(module_id_t Mod_id, uint8_t CC_id,rnti_t rnti, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag);
 
     /// Function to retrieve number of CCE
-    uint16_t (*get_nCCE_max)(module_id_t Mod_id,int CC_id);
+    uint16_t (*get_nCCE_max)(module_id_t Mod_id,uint8_t  CC_id);
 
     /// Function to retrieve number of PRB in an rb_alloc
     uint32_t (*get_nb_rb)(uint8_t ra_header, uint32_t rb_alloc, int n_rb_dl);
 
     /// Function to retrieve transmission mode for UE
-    uint8_t (*get_transmission_mode)(module_id_t Mod_id,int CC_id,rnti_t rnti);
+    uint8_t (*get_transmission_mode)(module_id_t Mod_id,uint8_t CC_id,rnti_t rnti);
 
     /// Function to retrieve rb_alloc bitmap from dci rballoc field and VRB type
     uint32_t (*get_rballoc)(uint8_t vrb_type, uint16_t rb_alloc_dci);
 
     /// Function for UE MAC to retrieve current PHY connectivity mode (PRACH,RA_RESPONSE,PUSCH)
-    UE_MODE_t (*get_ue_mode)(module_id_t Mod_id,int CC_id,uint8_t eNB_index);
+    UE_MODE_t (*get_ue_mode)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
 
     /// Function for UE MAC to retrieve measured Path Loss
     int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
@@ -274,21 +284,25 @@ typedef struct
     uint8_t (*get_fid_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index);
 
     /// Function for eNB MAC to retrieve subframe direction
-    lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t subframe);
+    lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t CC_id, uint8_t subframe);
 
     // MAC Helper functions
     /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (Po_NOMINAL_PUSCH parameter)
-    int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,int CC_id);
+    int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,uint8_t  CC_id);
 
     /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (deltaP_rampup parameter)
-    int8_t (*get_deltaP_rampup)(module_id_t Mod_id,int CC_id);
+    int8_t (*get_deltaP_rampup)(module_id_t Mod_id,uint8_t CC_id);
 
     /// Function for UE/PHY to compute PHR
-    int8_t (*get_PHR)(module_id_t Mod_id, int CC_id,uint8_t eNB_index);
+    int8_t (*get_PHR)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
 
     void (*process_timing_advance)(module_id_t Mod_id,int16_t timing_advance);
 
-    LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, int CC_id, rnti_t rnti);
+    LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
+
+    LTE_DL_FRAME_PARMS* (*get_lte_frame_parms)(module_id_t Mod_id, uint8_t CC_id);
+
+    MU_MIMO_mode* (*get_mu_mimo_mode) (module_id_t Mod_id, uint8_t CC_id);
 
     unsigned char is_cluster_head;
     unsigned char is_primary_cluster_head;
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index 75391ac056c29b65c9decafa72b7f4da5da6e7d1..dc932943d2e5742d7b2f0737a96c26fc6dcbdd10 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -671,6 +671,10 @@ void  rrc_ue_process_measConfig(module_id_t ue_mod_idP, frame_t frameP, uint8_t
       rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
           (RadioResourceConfigCommonSIB_t *)NULL,
           (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+			 (SCellToAddMod_r10_t *)NULL,
+	  //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
           UE_rrc_inst[ue_mod_idP].MeasObj[eNB_index],
           (MAC_MainConfig_t *)NULL,
           0,
@@ -936,6 +940,10 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram
                   rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
                       (RadioResourceConfigCommonSIB_t *)NULL,
                       UE_rrc_inst[ue_mod_idP].physicalConfigDedicated[eNB_index],
+#ifdef Rel10
+				     (SCellToAddMod_r10_t *)NULL,
+		       //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
                       (MeasObjectToAddMod_t **)NULL,
                       UE_rrc_inst[ue_mod_idP].mac_MainConfig[eNB_index],
                       1,
@@ -992,6 +1000,10 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram
                   rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
                       (RadioResourceConfigCommonSIB_t *)NULL,
                       UE_rrc_inst[ue_mod_idP].physicalConfigDedicated[eNB_index],
+#ifdef Rel10
+				     (SCellToAddMod_r10_t *)NULL,
+		       //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
                       (MeasObjectToAddMod_t **)NULL,
                       UE_rrc_inst[ue_mod_idP].mac_MainConfig[eNB_index],
                       2,
@@ -1071,6 +1083,10 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram
               rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
                   (RadioResourceConfigCommonSIB_t *)NULL,
                   UE_rrc_inst[ue_mod_idP].physicalConfigDedicated[eNB_index],
+#ifdef Rel10
+				 (SCellToAddMod_r10_t *)NULL,
+		       //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
                   (MeasObjectToAddMod_t **)NULL,
                   UE_rrc_inst[ue_mod_idP].mac_MainConfig[eNB_index],
                   *UE_rrc_inst[ue_mod_idP].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity,
@@ -1471,6 +1487,10 @@ void rrc_ue_process_mobilityControlInfo(uint8_t eNB_index, uint8_t UE_id, frame_
   rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
       (RadioResourceConfigCommonSIB_t *)NULL,
       (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
       (MeasObjectToAddMod_t **)NULL,
       (MAC_MainConfig_t *)NULL,
       0,
@@ -1976,6 +1996,10 @@ int decode_SIB1(module_id_t ue_mod_idP,uint8_t eNB_index, uint8_t rsrq, uint8_t
   rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
       (RadioResourceConfigCommonSIB_t *)NULL,
       (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
       (MeasObjectToAddMod_t **)NULL,
       (MAC_MainConfig_t *)NULL,
       0,
@@ -2197,6 +2221,10 @@ int decode_SI(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index,uint8_t s
         rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
             &UE_rrc_inst[ue_mod_idP].sib2[eNB_index]->radioResourceConfigCommon,
             (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+  	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif			   
             (MeasObjectToAddMod_t **)NULL,
             (MAC_MainConfig_t *)NULL,
             0,
@@ -2316,6 +2344,10 @@ int decode_SI(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index,uint8_t s
         rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
             (RadioResourceConfigCommonSIB_t *)NULL,
             (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
             (MeasObjectToAddMod_t **)NULL,
             (MAC_MainConfig_t *)NULL,
             0,
@@ -2668,6 +2700,10 @@ void decode_MBSFNAreaConfiguration(module_id_t ue_mod_idP, uint8_t eNB_index, fr
   rrc_mac_config_req(ue_mod_idP,ENB_FLAG_NO,0,eNB_index,
       (RadioResourceConfigCommonSIB_t *)NULL,
       (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
       (MeasObjectToAddMod_t **)NULL,
       (MAC_MainConfig_t *)NULL,
       0,
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index 07b880cc172fddf900f47449cf184b383ef8f38d..f5f6b95fbc6c52caf52bd073467deec68eabdf97 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -295,6 +295,10 @@ static void init_SI(
                            (RadioResourceConfigCommonSIB_t *) &
                            eNB_rrc_inst[enb_mod_idP].sib2->radioResourceConfigCommon,
                            (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+			   (SCellToAddMod_r10_t *)NULL,
+			   //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                            (MeasObjectToAddMod_t **) NULL,
                            (MAC_MainConfig_t *) NULL, 0,
                            (struct LogicalChannelConfig *)NULL,
@@ -378,6 +382,10 @@ static void init_MCCH(
     rrc_mac_config_req(enb_mod_idP, ENB_FLAG_YES, 0, 0,
                        (RadioResourceConfigCommonSIB_t *) NULL,
                        (struct PhysicalConfigDedicated *)NULL,
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                        (MeasObjectToAddMod_t **) NULL,
                        (MAC_MainConfig_t *) NULL,
                        0,
@@ -751,7 +759,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
     DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
     DRB_config->rlc_Config = DRB_rlc_config;
 
-#ifdef EXMIMO_IOT
+#ifdef RRC_RLC_AM // EXMIMO_IOT
     DRB_rlc_config->present = RLC_Config_PR_am;
     DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
     DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
@@ -773,7 +781,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
     DRB_pdcp_config->rlc_AM = NULL;
     DRB_pdcp_config->rlc_UM = NULL;
 
-#ifdef EXMIMO_IOT
+#ifdef RRC_RLC_AM // EXMIMO_IOT
     PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
     DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
     PDCP_rlc_AM->statusReportRequired = FALSE;
@@ -1633,7 +1641,12 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover(
           "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ  (SRB1 UE %d) --->][MAC_eNB][MOD %02d][]\n",
           frameP, enb_mod_idP, ue_mod_idP, enb_mod_idP);
     rrc_mac_config_req(enb_mod_idP, ENB_FLAG_YES, ue_mod_idP, 0, (RadioResourceConfigCommonSIB_t *) NULL,
-                       eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP], (MeasObjectToAddMod_t **) NULL,
+                       eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP], 
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif		       
+		       (MeasObjectToAddMod_t **) NULL,
                        eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP], 1, SRB1_logicalChannelConfig,
                        eNB_rrc_inst[enb_mod_idP].measGapConfig[ue_mod_idP], (TDD_Config_t *) NULL,
                        (MobilityControlInfo_t *) NULL, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL,
@@ -2161,6 +2174,10 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover(
     rrc_mac_config_req(enb_mod_idP, ENB_FLAG_YES, ue_mod_idP, 0,
                        (RadioResourceConfigCommonSIB_t *) NULL,
                        eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                        (MeasObjectToAddMod_t **) NULL,
                        eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
                        1,
@@ -2381,6 +2398,10 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
                         0,
                         (RadioResourceConfigCommonSIB_t *) NULL,
                         eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                         (MeasObjectToAddMod_t **) NULL,
                         eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
                         DRB2LCHAN[i],
@@ -2419,6 +2440,10 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
                                        0,
                                        (RadioResourceConfigCommonSIB_t *) NULL,
                                        eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                                        (MeasObjectToAddMod_t **) NULL,
                                        eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
                                        DRB2LCHAN[i],
@@ -2498,6 +2523,10 @@ void rrc_eNB_generate_RRCConnectionSetup(
                 rrc_mac_config_req(enb_mod_idP, ENB_FLAG_YES, ue_mod_idP, 0,
                                    (RadioResourceConfigCommonSIB_t *) NULL,
                                    eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
+#ifdef Rel10
+	(SCellToAddMod_r10_t *)NULL,
+	//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+#endif
                                    (MeasObjectToAddMod_t **) NULL,
                                    eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
                                    1,
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index f4a0419de0529ddaa7e10eb41a7426b33fd85e70..fece0f9f459681dfb5fbaa54019a2332c15c751e 100755
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -64,6 +64,30 @@
 // main log variables
 log_t *g_log;
 
+mapping log_level_names[] =
+{
+    {"emerg", LOG_EMERG},
+    {"alert", LOG_ALERT},
+    {"crit", LOG_CRIT},
+    {"error", LOG_ERR},
+    {"warn", LOG_WARNING},
+    {"notice", LOG_NOTICE},
+    {"info", LOG_INFO},
+    {"debug", LOG_DEBUG},
+    {"file", LOG_FILE},
+    {"trace", LOG_TRACE},
+    {NULL, -1}
+};
+mapping log_verbosity_names[] =
+{
+  {"none", 0x0},
+  {"low", 0x5},
+  {"medium", 0x15},
+  {"high", 0x35},
+  {"full", 0x75},
+  {NULL, -1}
+};
+
 // vars for the log thread
 LOG_params log_list[2000];
 int log_list_tail = 0;
diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h
index d3c995de0c2a6f4dd77fac5a3bcaadf810623178..950e7b9732333d97462a1747e114fe6dbcf82292 100755
--- a/openair2/UTIL/LOG/log.h
+++ b/openair2/UTIL/LOG/log.h
@@ -322,14 +322,6 @@ typedef struct LOG_params {
   int len;
 } LOG_params;
 
-extern log_t *g_log;
-
-#if !defined(LOG_NO_THREAD)
-extern LOG_params log_list[2000];
-extern pthread_mutex_t log_lock;
-extern pthread_cond_t log_notify;
-extern int log_shutdown;
-#endif
 
 #if defined(ENABLE_ITTI)
 typedef enum log_instance_type_e {
diff --git a/openair2/UTIL/LOG/log_extern.h b/openair2/UTIL/LOG/log_extern.h
index 07a64d6079278e56b194b0407dd9ea6e10d5793c..d8c509bea0545876ebb2ab3b3e0b09452aad9d18 100644
--- a/openair2/UTIL/LOG/log_extern.h
+++ b/openair2/UTIL/LOG/log_extern.h
@@ -26,3 +26,17 @@
   Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
 
 *******************************************************************************/
+
+#include"log.h"
+
+extern log_t *g_log;
+
+#if !defined(LOG_NO_THREAD)
+extern LOG_params log_list[2000];
+extern pthread_mutex_t log_lock;
+extern pthread_cond_t log_notify;
+extern int log_shutdown;
+#endif
+
+extern mapping log_level_names[]; 
+extern mapping log_verbosity_names[];
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c
index 2c3e6a028c839b0c198621e628ea055ec090203c..db36ce847676a5aa532a6ed375d7359ca094547b 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.c
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.c
@@ -92,41 +92,10 @@ const char* eurecomVariablesNames[] = {
 };
  
 const char* eurecomFunctionsNames[] = {
-    "macxface_macphy_init",
-    "macxface_macphy_exit",
-    "macxface_eNB_dlsch_ulsch_scheduler",
-    "macxface_fill_rar",
-    "macxface_terminate_ra_proc",
-    "macxface_initiate_ra_proc",
-    "macxface_cancel_ra_proc",
-    "macxface_get_dci_sdu",
-    "macxface_get_dlsch_sdu",
-    "macxface_rx_sdu",
-    "macxface_mrbch_phy_sync_failure",
-    "macxface_SR_indication",
-    "macxface_phy_config_sib1_eNB",
-    "macxface_phy_config_sib2_eNB",
-    "macxface_phy_config_dedicated_eNB",
-    "macxface_out_of_sync_ind",
-    "macxface_ue_decode_si",
-    "macxface_ue_decode_ccch",
-    "macxface_ue_decode_bcch",
-    "macxface_ue_send_sdu",
-    "macxface_ue_get_sdu",
-    "macxface_ue_get_rach",
-    "macxface_ue_process_rar",
-    "macxface_ue_scheduler",
-    "macxface_ue_get_sr",
-    "ue_send_mch_sdu",
-    "lte_ue_measurement_procedures",
-    "lte_ue_pdcch_procedures",
-    "lte_ue_pbch_procedures",
-    "phy_procedures_eNb_tx",
-    "phy_procedures_eNb_rx",
-    "phy_procedures_ue_tx",
-    "phy_procedures_ue_rx",
-    "phy_procedures_eNB_lte",
-    "phy_procedures_UE_lte",
+  /*  softmodem signals   */  
+    "rt_sleep",
+    "trx_read",
+    "trx_write",
     "eNB_thread_tx0",
     "eNB_thread_rx0",
     "eNB_thread_tx1",
@@ -147,12 +116,17 @@ const char* eurecomFunctionsNames[] = {
     "eNB_thread_rx8",
     "eNB_thread_tx9",
     "eNB_thread_rx9",
-    "emu_transport",
-    "log_record",
-    "pdcp_run",
-    "rt_sleep",
-    "trx_read",
-    "trx_write",
+    
+    /* PHY signals  */
+    "lte_ue_measurement_procedures",
+    "lte_ue_pdcch_procedures",
+    "lte_ue_pbch_procedures",
+    "phy_procedures_eNb_tx",
+    "phy_procedures_eNb_rx",
+    "phy_procedures_ue_tx",
+    "phy_procedures_ue_rx",
+    "phy_procedures_eNB_lte",
+    "phy_procedures_UE_lte",
     "pdsch_thread",
     "dlsch_thread0",
     "dlsch_thread1",
@@ -171,11 +145,11 @@ const char* eurecomFunctionsNames[] = {
     "dlsch_decoding6",
     "dlsch_decoding7",
     "rx_pdcch",
-    "dci_decoding",
-    "rrc_mac_config_req",
-    "rrc_ue_decode_sib1",
-    "rrc_ue_decode_si",
-    "phy_ue_config_sib2",
+    "dci_decoding",  
+    "phy_ue_config_sib2", 
+    "macxface_phy_config_sib1_eNB",
+    "macxface_phy_config_sib2_eNB",
+    "macxface_phy_config_dedicated_eNB",
     "phy_ue_compute_prach",
     "phy_enb_ulsch_decoding",
     "phy_enb_sfgen",
@@ -188,8 +162,56 @@ const char* eurecomFunctionsNames[] = {
     "phy_eNB_dlsch_modulation",
     "phy_eNB_dlsch_encoding",
     "phy_eNB_dlsch_scrambling",
+   
+    /* MAC  signals  */
+    "macxface_macphy_init",
+    "macxface_macphy_exit",
+    "macxface_eNB_dlsch_ulsch_scheduler",
+    "macxface_fill_rar",
+    "macxface_terminate_ra_proc",
+    "macxface_initiate_ra_proc",
+    "macxface_cancel_ra_proc",
+    "macxface_get_dci_sdu",
+    "macxface_get_dlsch_sdu",
+    "macxface_rx_sdu",
+    "macxface_mrbch_phy_sync_failure",
+    "macxface_SR_indication",
+    "mac_dlsch_preprocessor",
+    "mac_schedule_dlsch",
+    "mac_fill_dlsch_dci",
+    "macxface_out_of_sync_ind",
+    "macxface_ue_decode_si",
+    "macxface_ue_decode_ccch",
+    "macxface_ue_decode_bcch",
+    "macxface_ue_send_sdu",
+    "macxface_ue_get_sdu",
+    "macxface_ue_get_rach",
+    "macxface_ue_process_rar",
+    "macxface_ue_scheduler",
+    "macxface_ue_get_sr",
+    
+    "ue_send_mch_sdu",
+
+    /*RLC signals   */
+    "rlc_data_req",
+    // "rlc_data_ind", // this calls "pdcp_data_ind",
+    "mac_rlc_status_ind",
+    "mac_rlc_data_req",
+    "mac_rlc_data_ind",
+    /* PDCP signals   */
+    "pdcp_run",
+    "pdcp_data_req",
+    "pdcp_data_ind",
     "pdcp_apply_security",
     "pdcp_validate_security",
+    /* RRC signals  */
+    "rrc_mac_config_req",
+    "rrc_ue_decode_sib1",
+    "rrc_ue_decode_si",
+    
+    /* MISC signals  */
+    "emu_transport",
+    "log_record",
     "itti_enqueue_message",
     "itti_dump_enqueue_message",
     "itti_dump_enqueue_message_malloc",
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h
index 5823782e1b7f8f7729bf78a55551fe312e3f0ddc..6dedf7d71d0314079af288e4c9653bfb8412b061 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.h
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.h
@@ -66,113 +66,136 @@ typedef enum
     VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST,
 } vcd_signal_dump_variables;
 
-typedef enum
-{
-    VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_INIT = 0,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_EXIT,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_RAR,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_CANCEL_RA_PROC,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DCI_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DLSCH_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_MRBCH_PHY_SYNC_FAILURE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_DEDICATED_ENB,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_OUT_OF_SYNC_IND,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_RACH,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PROCESS_RAR,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SR,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX1,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX1,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX2,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX2,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX3,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX3,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX4,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX4,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX5,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX5,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX6,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX6,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX7,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX7,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX8,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX8,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX9,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX9,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_THREAD,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD0,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD1,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD2,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD3,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD4,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD5,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD6,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD7,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING1,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING2,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING3,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING4,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING5,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING6,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING7,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_SCRAMBLING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
-    VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
+typedef enum {
+   /* softmodem signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP=0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX1,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX1,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX2,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX2,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX3,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX3,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX4,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX4,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX5,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX5,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX6,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX6,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX7,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX7,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX8,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX8,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_TX9,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX9,
+ 
+ /* PHY signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_THREAD,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD1,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD2,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD3,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD4,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD5,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD6,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD7,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING1,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING2,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING3,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING4,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING5,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING6,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING7,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_DEDICATED_ENB,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_SCRAMBLING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
+  
+  /* MAC signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_INIT,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_EXIT, 
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_RAR,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_CANCEL_RA_PROC,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DCI_SDU,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DLSCH_SDU,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MRBCH_PHY_SYNC_FAILURE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, 
+  VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, // schedule_ue_spec
+  VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
+  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_OUT_OF_SYNC_IND,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_RACH,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PROCESS_RAR,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SR,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU,
+  
+  /* RLC signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,
+  // VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_IND,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND, 
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,
+
+  /* PDCP signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
+  
+  /* RRC signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI,
+
+  /* MISC signals  */  
+  VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
+  VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
 } vcd_signal_dump_functions;
 
 typedef enum
diff --git a/targets/Makefile.common b/targets/Makefile.common
index eb73d1b38d91ec79aa7a5207e1a544cf97ae6415..824c7be45025be0502f47e5618894da603b30500 100644
--- a/targets/Makefile.common
+++ b/targets/Makefile.common
@@ -63,12 +63,12 @@ SHARED_DEPENDENCIES += $(ITTI_MESSAGES_H)
 endif
 
 ifdef USE_MME
-LIBS				+= $(X2AP_OBJ_DIR)/libx2ap.a
+#LIBS				+= $(X2AP_OBJ_DIR)/libx2ap.a
 LIBS				+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a 
 LIBS				+= $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a -lsctp -lcrypt
 LIBS				+= $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a 
-SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(X2AP_OBJ_DIR)/libx2ap.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
-#SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
+#SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(X2AP_OBJ_DIR)/libx2ap.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
+SHARED_DEPENDENCIES	+= $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a  $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
 
 COMMON_CFLAGS		+= -DLOG_NO_THREAD 
 #-DEMIT_ASN_DEBUG
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index 7ab2896643ad2e02bcea731b2a579c678ec978ca..dc4cd726a450f64e36c9c3e10898b1c610dd4f0c 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -18,7 +18,7 @@ CPUFLAGS += $(shell if grep --silent -w sse4 /proc/cpuinfo ; then echo "-msse4"
 linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)
 
 ifdef DEBUG
-CFLAGS += -g -ggdb -DDEBUG_PHY
+CFLAGS += -g -ggdb -DDEBUG_PHY -DDEBUG_MEAS
 else 
 CFLAGE += -O2	
 endif
diff --git a/targets/SIMU/USER/event_handler.c b/targets/SIMU/USER/event_handler.c
index dfe1e00b4da4608aaf0693920a89c708a095dfe3..af13cbaff609c3d641cc5650c2df83ad3c763f12 100644
--- a/targets/SIMU/USER/event_handler.c
+++ b/targets/SIMU/USER/event_handler.c
@@ -335,115 +335,114 @@ void update_mac(Event_t event) {
 	LOG_I(EMU,"A NEW MAC MODEL\n");
 	int i = 0;
 	UE_list_t *UE_list;
+	int enb_module_id=0;
+	int cc_id =0;	
+	eNB_MAC_INST *eNB_mac_inst = get_eNB_mac_inst(enb_module_id);
+	OAI_Emulation *oai_emulation  = get_OAI_emulation();
 	if(event.optype == READ)
 	{
-		
-		eNB_MAC_INST *eNB_mac_inst;
-		eNB_mac_inst = get_eNB_mac_inst();
-		printf("eNB_stats\n\n\n");
+	  
+	  printf("eNB_stats\n\n\n");
 		if(event.key==NULL)
 		{
 			
 			LOG_I(EMU,"num_dlactive_UEs :");			
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.num_dlactive_UEs);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].num_dlactive_UEs);
 			LOG_I(EMU,"available_prbs :");	
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.available_prbs);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].available_prbs);
 			LOG_I(EMU,"total_available_prbs :");	
-			printf("%" PRIu32 "\n", eNB_mac_inst->eNB_stats.total_available_prbs);
+			printf("%" PRIu32 "\n", eNB_mac_inst->eNB_stats[cc_id].total_available_prbs);
 			LOG_I(EMU,"available_ncces :");	
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.available_ncces);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].available_ncces);
 			LOG_I(EMU,"dlsch_bitrate :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_bitrate);
 			LOG_I(EMU,"dlsch_bytes_tx :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_bytes_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_bytes_tx);
 			LOG_I(EMU,"dlsch_pdus_tx :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_pdus_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_pdus_tx);
 			LOG_I(EMU,"total_dlsch_bitrate :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_bitrate);
 			LOG_I(EMU,"total_dlsch_bytes_tx :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_bytes_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_bytes_tx);
 			LOG_I(EMU,"total_dlsch_pdus_tx :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_pdus_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_pdus_tx);
 			LOG_I(EMU,"ulsch_bitrate :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.ulsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_bitrate);
 			LOG_I(EMU,"ulsch_bytes_rx :");	
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.ulsch_bytes_rx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_bytes_rx);
 			LOG_I(EMU,"ulsch_pdus_rx :");	
-			printf("%" PRIu64 "\n",eNB_mac_inst->eNB_stats.ulsch_pdus_rx);
+			printf("%" PRIu64 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_pdus_rx);
 		}
 		else if(!strcmp((char *) event.key, "num_dlactive_UEs"))
 		{
 			LOG_I(EMU,"num_dlactive_UEs :");			
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.num_dlactive_UEs);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].num_dlactive_UEs);
 		}
 		else if(!strcmp((char *) event.key, "available_prbs"))
 		{
 			LOG_I(EMU,"available_prbs :");			
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.available_prbs);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].available_prbs);
 		}
 		else if(!strcmp((char *) event.key, "total_available_prbs"))
 		{
 			LOG_I(EMU,"total_available_prbs :");			
-			printf("%" PRIu32 "\n", eNB_mac_inst->eNB_stats.total_available_prbs);
+			printf("%" PRIu32 "\n", eNB_mac_inst->eNB_stats[cc_id].total_available_prbs);
 		}
 		else if(!strcmp((char *) event.key, "available_ncces"))
 		{
 			LOG_I(EMU,"available_ncces :");			
-			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats.available_ncces);
+			printf("%" PRIu16 "\n",eNB_mac_inst->eNB_stats[cc_id].available_ncces);
 		}
 		else if(!strcmp((char *) event.key, "dlsch_bitrate"))
 		{
 			LOG_I(EMU,"dlsch_bitrate :");
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_bitrate);
 		}
 		else if(!strcmp((char *) event.key, "dlsch_bytes_tx"))
 		{
 			LOG_I(EMU,"dlsch_bytes_tx :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_bytes_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_bytes_tx);
 		}
 		else if(!strcmp((char *) event.key, "dlsch_pdus_tx"))
 		{
 			LOG_I(EMU,"dlsch_pdus_tx :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.dlsch_pdus_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].dlsch_pdus_tx);
 		}
 		else if(!strcmp((char *) event.key, "total_dlsch_bitrate"))
 		{
 			LOG_I(EMU,"total_dlsch_bitrate :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_bitrate);
 		}
 		else if(!strcmp((char *) event.key, "total_dlsch_bytes_tx"))
 		{
 			LOG_I(EMU,"total_dlsch_bytes_tx :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_bytes_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_bytes_tx);
 		}
 		else if(!strcmp((char *) event.key, "total_dlsch_pdus_tx"))
 		{
 			LOG_I(EMU,"total_dlsch_pdus_tx :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.total_dlsch_pdus_tx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].total_dlsch_pdus_tx);
 		}
 		else if(!strcmp((char *) event.key, "ulsch_bitrate"))
 		{
 			LOG_I(EMU,"ulsch_bitrate :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.ulsch_bitrate);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_bitrate);
 		}
 		else if(!strcmp((char *) event.key, "ulsch_bytes_rx"))
 		{
 			LOG_I(EMU,"ulsch_bytes_rx :");			
-			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats.ulsch_bytes_rx);
+			printf("%" PRIu32 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_bytes_rx);
 		}
 		else if(!strcmp((char *) event.key, "ulsch_pdus_rx"))
 		{
 			LOG_I(EMU,"ulsch_pdus_rx :");			
-			printf("%" PRIu64 "\n",eNB_mac_inst->eNB_stats.ulsch_pdus_rx);
+			printf("%" PRIu64 "\n",eNB_mac_inst->eNB_stats[cc_id].ulsch_pdus_rx);
 		}
 	}
 	else if(event.optype == WRITE)
 	{
 		LOG_I(EMU,"WRITE OPERATION \n");			
-		eNB_MAC_INST *eNB_mac_inst;
-		eNB_mac_inst = get_eNB_mac_inst();
-		OAI_Emulation *oai_emulation;
-		oai_emulation = get_OAI_emulation();
+		
 		
 		if(event.key==NULL && event.value!=NULL)
 		{
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 8aaae67eaa9dd438ca429445852cb021c9af4825..18f2da383e9f74b7ddfcdf08ac25183c0c3596ae 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -720,8 +720,9 @@ void *l2l1_task(void *args_p) {
 
 #ifdef PRINT_STATS
                       if(last_slot==9 && frame%10==0)
-                        if(eNB_avg_thr)
-                          fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_inst][0]->frame,(PHY_vars_eNB_g[eNB_inst][0]->total_system_throughput)/((PHY_vars_eNB_g[eNB_inst][0]->frame+1)*10));
+                        if(eNB_avg_thr) 
+                          fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx,
+				  (PHY_vars_eNB_g[eNB_inst]->total_system_throughput)/((PHY_vars_eNB_g[eNB_inst]->proc[slot>>1].frame_tx+1)*10));
                       if (eNB_stats[eNB_inst]) {
                           len = dump_eNB_stats(PHY_vars_eNB_g[eNB_inst][0], stats_buffer, 0);
                           rewind (eNB_stats[eNB_inst]);
@@ -1585,9 +1586,10 @@ void oai_shutdown(void) {
   
   LOG_N(EMU, ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU shutdown <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
 }
-eNB_MAC_INST* get_eNB_mac_inst()
+
+eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP)
 {
-	return eNB_mac_inst;
+  return (&eNB_mac_inst[module_idP]);
 }
 
 OAI_Emulation* get_OAI_emulation()
diff --git a/targets/SIMU/USER/oaisim.h b/targets/SIMU/USER/oaisim.h
index d36ed7022de685b49fd0865b0be487cb09664bfe..b89a6c639e53c08d7c83e0bbaa64754166a19984 100644
--- a/targets/SIMU/USER/oaisim.h
+++ b/targets/SIMU/USER/oaisim.h
@@ -17,7 +17,7 @@
 #include "UTIL/OMV/structures.h"
 #endif
 
-eNB_MAC_INST* get_eNB_mac_inst(void);
+eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP);
 OAI_Emulation* get_OAI_emulation(void);
 void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0);
 
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index 5b36b680a32e5ce91ff18c98bdcdafdf0f2183b1..817d2b086407771a0d2f735315755c4fecf6806b 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -63,29 +63,7 @@
 # include "intertask_interface_init.h"
 #endif
 
-mapping log_level_names[] =
-{
-    {"emerg", LOG_EMERG},
-    {"alert", LOG_ALERT},
-    {"crit", LOG_CRIT},
-    {"error", LOG_ERR},
-    {"warn", LOG_WARNING},
-    {"notice", LOG_NOTICE},
-    {"info", LOG_INFO},
-    {"debug", LOG_DEBUG},
-    {"file", LOG_FILE},
-    {"trace", LOG_TRACE},
-    {NULL, -1}
-};
-mapping log_verbosity_names[] =
-{
-  {"none", 0x0},
-  {"low", 0x5},
-  {"medium", 0x15},
-  {"high", 0x35},
-  {"full", 0x75},
-  {NULL, -1}
-};
+
 mapping omg_model_names[] =
 {
     {"STATIC", STATIC},
diff --git a/targets/TEST/OAI/case01.py b/targets/TEST/OAI/case01.py
index f24d776b2b7f56ae40e77ed851e10f3e7ad8d7fc..b89b911ba1c04de662771f96834d9a1a100c8c78 100644
--- a/targets/TEST/OAI/case01.py
+++ b/targets/TEST/OAI/case01.py
@@ -30,7 +30,7 @@
 # \file case01.py
 # \brief test case 01 for OAI: compilations
 # \author Navid Nikaein
-# \date 2013
+# \date 2013 - 2014
 # \version 0.1
 # @ingroup _test
 
@@ -41,9 +41,10 @@ import core
 makerr1 = '***'
 makerr2 = 'Error 1'
 
-def execute(oai, user, pw, logfile,logdir):
+def execute(oai, user, pw, host, logfile,logdir,debug):
     
     case = '01'
+    rv = 1
     oai.send('cd $OPENAIR_TARGETS;')   
  
     try:
@@ -75,11 +76,12 @@ def execute(oai, user, pw, logfile,logdir):
         diag = "check the compilation errors for oai"
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
-        oai.send('rm -f ./oaisim.rel8;')
+        oai.send('rm -f ./oaisim.rel8.'+host)
         oai.send_expect_false('make -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel8;')
+        oai.send('cp ./oaisim ./oaisim.rel8.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
         
@@ -89,7 +91,7 @@ def execute(oai, user, pw, logfile,logdir):
         conf = 'make nasmesh_fix; make NAS=1'
         diag = 'check the compilation errors for oai and nas driver'
         oai.send('make cleanall;')
-        oai.send('rm -f ./oaisim.rel8.nas;')
+        oai.send('rm -f ./oaisim.rel8.nas'+host)
         oai.send('rm -f ./nasmesh;')
         oai.send('make nasmesh_clean;')
         trace = logdir + '/log_' + case + test + '_1.txt;'
@@ -98,10 +100,11 @@ def execute(oai, user, pw, logfile,logdir):
         trace = logdir + '/log_' + case + test + '_2.txt;'
         tee = ' 2>&1 | tee ' + trace
         oai.send_expect_false('make NAS=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel8.nas;')
+        oai.send('cp ./oaisim ./oaisim.rel8.nas.'+host)
         
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
     
@@ -116,9 +119,9 @@ def execute(oai, user, pw, logfile,logdir):
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for Rel8'
         oai.send('make cleanall;')
-        oai.send('rm -f ./oaisim.rel8.rf;')
+        oai.send('rm -f ./oaisim.rel8.rf.'+host)
         oai.send_expect_false('make RTAI=0 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel8.rf;')
+        oai.send('cp ./oaisim ./oaisim.rel8.rf.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -135,11 +138,12 @@ def execute(oai, user, pw, logfile,logdir):
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
         oai.send('make clean;')
-        oai.send('rm -f ./dlsim.rel8;')
+        oai.send('rm -f ./dlsim.rel8.'+host)
         oai.send_expect_false('make dlsim -j4' + tee, makerr1,  1500)
-        oai.send('cp ./dlsim ./dlsim.rel8;')
+        oai.send('cp ./dlsim ./dlsim.rel8.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
 
@@ -151,11 +155,12 @@ def execute(oai, user, pw, logfile,logdir):
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for ulsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
         oai.send('make clean;')
-        oai.send('rm -f ./ulsim.rel8;')
+        oai.send('rm -f ./ulsim.rel8.'+host)
         oai.send_expect_false('make ulsim -j4' + tee, makerr1,  1500)
-        oai.send('cp ./ulsim ./ulsim.rel8;')
+        oai.send('cp ./ulsim ./ulsim.rel8.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
     
@@ -170,11 +175,12 @@ def execute(oai, user, pw, logfile,logdir):
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for ITTI Rel8'
         oai.send('make clean;')
-        oai.send('rm -f ./oaisim.rel8.itti;')
+        oai.send('rm -f ./oaisim.rel8.itti.'+host)
         oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel8.itti;')
+        oai.send('cp ./oaisim ./oaisim.rel8.itti.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
 
@@ -188,11 +194,12 @@ def execute(oai, user, pw, logfile,logdir):
         oai.send('make clean;')
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
-        oai.send('rm -f ./oaisim.rel10;')
+        oai.send('rm -f ./oaisim.rel10.'+host)
         oai.send_expect_false('make RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel10;')
+        oai.send('cp ./oaisim ./oaisim.rel10.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
 
@@ -204,11 +211,12 @@ def execute(oai, user, pw, logfile,logdir):
         tee = ' 2>&1 | tee ' + trace
         diag = 'check the compilation errors for ITTI Rel10'
         oai.send('make cleanall;')
-        oai.send('rm -f ./oaisim.rel10.itti;')
+        oai.send('rm -f ./oaisim.rel10.itti.'+host)
         oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel10.itti;')
+        oai.send('cp ./oaisim ./oaisim.rel10.itti.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
+        rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
     try:
@@ -239,9 +247,9 @@ def execute(oai, user, pw, logfile,logdir):
         oai.send('make clean;')
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
-        oai.send('rm -f ./oaisim.rel8.itti.ral;')
+        oai.send('rm -f ./oaisim.rel8.itti.ral.'+host)
         oai.send_expect_false('make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel8.itti.ral;')
+        oai.send('cp ./oaisim ./oaisim.rel8.itti.ral.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -256,12 +264,14 @@ def execute(oai, user, pw, logfile,logdir):
         oai.send('make clean;')
         oai.send('make cleanall;')
         oai.send('make cleanasn1;')
-        oai.send('rm -f ./oaisim.rel10.itti.ral;')
+        oai.send('rm -f ./oaisim.rel10.itti.ral.'+host)
         oai.send_expect_false('make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1,  1500)
-        oai.send('cp ./oaisim ./oaisim.rel10.itti.ral;')
+        oai.send('cp ./oaisim ./oaisim.rel10.itti.ral.'+host)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
         log.ok(case, test, name, conf, '', logfile)
 
+    return rv
+
 
diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py
index 717cda3a5452f06cf5ebbb5fef00c9423f8823cc..e9a4853aa929d1a747b456272c4ac524697cc975 100644
--- a/targets/TEST/OAI/case02.py
+++ b/targets/TEST/OAI/case02.py
@@ -44,7 +44,7 @@ NUM_UE=2
 NUM_eNB=1
 NUM_TRIALS=3
 
-def execute(oai, user, pw, logfile,logdir):
+def execute(oai, user, pw, host, logfile,logdir,debug):
     
     case = '02'
     oai.send('cd $OPENAIR_TARGETS;')
@@ -55,15 +55,15 @@ def execute(oai, user, pw, logfile,logdir):
         name = 'Run oai.rel8.sf'
         conf = '-a -A AWGN -n 100'
         diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
-        trace = logdir + '/log_' + case + test + '_1.txt;'
+        trace = logdir + '/log_' + host + case + test + '_1.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'Segmentation fault', 30)
-        trace = logdir + '/log_' + case + test + '_2.txt;'
+        oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
+        trace = logdir + '/log_' + host + case + test + '_2.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'Exiting', 30)
-        trace = logdir + '/log_' + case + test + '_3.txt;'
+        oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
+        trace = logdir + '/log_' + host + case + test + '_3.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel8 ' + conf + tee, 'FATAL', 30)
+        oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
 
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -74,10 +74,10 @@ def execute(oai, user, pw, logfile,logdir):
         test = '01'
         name = 'Run oai.rel8.err'
         conf = '-a -A AWGN -n 100 -l7'
-        trace = logdir + '/log_' + case + test + '_3.txt;'
+        trace = logdir + '/log_' + host + case + test + '_3.txt;'
         tee = ' 2>&1 | tee ' + trace
         diag = '[E] Error(s) found during the execution, check the execution logs'
-        oai.send_expect_false('./oaisim.rel8 ' + conf, '[E]', 30)
+        oai.send_expect_false('./oaisim.rel8.'+ host + ' ' + conf, '[E]', 30)
         
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -91,9 +91,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-a -A AWGN -l7 -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 50)
+                oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 50)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -109,26 +109,26 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_eNB) :
             for j in range(NUM_UE) :
                 conf = '-a -A AWGN -l6 -u' + str(j+1) +' -b'+ str(i+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 > ' + trace
 
                 if user == 'root' :
-                    oai.send('./oaisim.rel8.nas ' + conf + ' &')
+                    oai.send('./oaisim.rel8.nas.' + host + ' ' + conf + ' &')
                 else :    
-                    oai.send('echo '+pw+ ' | sudo -S -E ./oaisim.rel8.nas ' + conf + tee + ' &')
+                    oai.send('echo '+pw+ ' | sudo -S -E ./oaisim.rel8.nas.'+ host + ' ' + conf + tee + ' &')
                 time.sleep(20)
                 for k in range(NUM_TRIALS) :
-                    trace_ping = logdir + '/log_' + case + test + '_' + str(i) + str(j) + str(k) + '_ping.txt'
+                    trace_ping = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + str(k) + '_ping.txt'
                     tee_ping = ' 2>&1 | tee ' + trace_ping
 
                     oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' +  str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 20)
                 if user == 'root' :
-                    oai.send('pkill oaisim.rel8.nas;')
-                    oai.send('pkill oaisim.rel8.nas;')
+                    oai.send('pkill oaisim.rel8.nas.'+host)
+                    oai.send('pkill oaisim.rel8.nas.'+host)
                 else :
-                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
+                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
                     time.sleep(1)
-                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
+                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
         
         oai.rm_driver(oai,user,pw)
 
@@ -144,9 +144,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -s 20 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -x1'
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
+                oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -159,9 +159,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -F -s 20 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -x1'
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel8 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
+                oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -173,12 +173,12 @@ def execute(oai, user, pw, logfile,logdir):
         diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.sfr.sud.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
-                log_name = logdir + '/log_' + case + test + '_' + str(i) + str(j)
+                log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
                 itti_name = log_name + '.log'
                 trace_name = log_name + '.txt'
                 conf = '-a -l7 -A AWGN --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
                 tee = ' 2>&1 | tee -a ' + trace_name
-                command = './oaisim.rel8.itti ' + conf
+                command = './oaisim.rel8.itti.' + host + ' ' + conf
                 oai.send('echo ' + command + ' > ' + trace_name + ';')
                 oai.send_expect(command + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 50)
     except log.err, e:
@@ -192,9 +192,9 @@ def execute(oai, user, pw, logfile,logdir):
         name = 'Run oai.rel8.abs.ocg.otg'
         diag = 'Check the scenario if the tests 0202 and 0203 are passed.'
         conf = '-a -c26'
-        trace = logdir + '/log_' + case + test + '.txt'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./oaisim.rel8 ' + conf + tee, ' DL and UL loss rate below 10% ', 500)
+        oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' DL and UL loss rate below 10% ', 500)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
diff --git a/targets/TEST/OAI/case03.py b/targets/TEST/OAI/case03.py
index 303ae013df5f724fce8a022bf3458062b0395a21..73459686a9f4edc3d3140f2fe1888bc0e6b1c8b0 100644
--- a/targets/TEST/OAI/case03.py
+++ b/targets/TEST/OAI/case03.py
@@ -44,7 +44,7 @@ NUM_UE=2
 NUM_eNB=1
 NUM_TRIALS=3
 
-def execute(oai, user, pw, logfile,logdir):
+def execute(oai, user, pw, host, logfile,logdir,debug):
     
     case = '03'
     oai.send('cd $OPENAIR_TARGETS;')
@@ -55,15 +55,15 @@ def execute(oai, user, pw, logfile,logdir):
         name = 'Run oai.rel10.sf'
         conf = '-a -A AWGN -l7 -n 100'
         diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
-        trace = logdir + '/log_' + case + test + '_1.txt'
+        trace = logdir + '/log_' + host + case + test + '_1.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'Segmentation fault', 30)
-        trace = logdir + '/log_' + case + test + '_2.txt'
+        oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
+        trace = logdir + '/log_' + host + case + test + '_2.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'Exiting', 30)
-        trace = logdir + '/log_' + case + test + '_3.txt'
+        oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'Exiting', 30)
+        trace = logdir + '/log_' + host + case + test + '_3.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./oaisim.rel10 ' + conf + tee, 'FATAL', 30)
+        oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'FATAL', 30)
 
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -74,10 +74,10 @@ def execute(oai, user, pw, logfile,logdir):
         test = '01'
         name = 'Run oai.rel10.err'
         conf = '-a -A AWGN -l7 -n 100'
-        trace = logdir + '/log_' + case + test + '.txt'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
         diag = 'Error(s) found in the execution, check the execution logs'
-        oai.send_expect_false('./oaisim.rel10 ' + conf + tee, '[E]', 30)
+        oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, '[E]', 30)
         
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -91,9 +91,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-a -l7 -A AWGN -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 100)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 100)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -106,9 +106,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -s20 -l7 -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -121,9 +121,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -s20 -l7 -F -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i),  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -136,9 +136,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -l7 -x 1 -Q3 -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j),  (i+1) * 200)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j),  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -151,9 +151,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -l7 -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received a multicast packet',  (i+1) * 200)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received a multicast packet',  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -166,9 +166,9 @@ def execute(oai, user, pw, logfile,logdir):
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
                 conf = '-A AWGN -l7 -F -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
-                trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
+                trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
                 tee = ' 2>&1 | tee ' + trace
-                oai.send_expect('./oaisim.rel10 ' + conf + tee, ' Received a multicast packet',  (i+1) * 200)
+                oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received a multicast packet',  (i+1) * 200)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -192,12 +192,12 @@ def execute(oai, user, pw, logfile,logdir):
         diag = 'eMBMS procedure is not finished completely, check the eNB config file (enb.sfr.sud.conf), and make sure that the SIB13/MCCH have been correclty received by UEs'
         for i in range(NUM_UE) :
             for j in range(NUM_eNB) :
-                log_name = logdir + '/log_' + case + test + '_' + str(i) + str(j)
+                log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
                 itti_name = log_name + '.log'
                 trace_name = log_name + '.txt'
                 conf = '-A AWGN -l7 -x 1 -Q3 --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
                 tee = ' 2>&1 | tee -a ' + trace_name
-                command = './oaisim.rel10.itti ' + conf
+                command = './oaisim.rel10.itti.' + host + ' ' + conf
                 oai.send('echo ' + command + ' > ' + trace_name + ';')
                 oai.send_expect(command + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j),  (i+1) * 200)
     except log.err, e:
diff --git a/targets/TEST/OAI/case04.py b/targets/TEST/OAI/case04.py
index c4b40abd77089bf18497c0aa15f0b982613ca7f0..8b214787ed5a61fbd5a08dff923615666d723084 100644
--- a/targets/TEST/OAI/case04.py
+++ b/targets/TEST/OAI/case04.py
@@ -44,7 +44,7 @@ NUM_UE=2
 NUM_eNB=1
 NUM_TRIALS=3
 
-def execute(oai, user, pw, logfile,logdir):
+def execute(oai, user, pw, host, logfile,logdir,debug):
     
     case = '04'
     oai.send('cd $OPENAIR1_DIR;')     
@@ -52,18 +52,18 @@ def execute(oai, user, pw, logfile,logdir):
     
     try:
         test = '00'
-        name = 'Run oai.dlsim.sanity'
+        name = 'Perf oai.dlsim.sanity'
         conf = '-a -A AWGN -n 100'
         diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
-        trace = logdir + '/log_' + case + test + '_1.txt;'
+        trace = logdir + '/log_' + host + case + test + '_1.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Segmentation fault', 30)
-        trace = logdir + '/log_' + case + test + '_2.txt;'
+        oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
+        trace = logdir + '/log_' + host + case + test + '_2.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Exiting', 30)
-        trace = logdir + '/log_' + case + test + '_3.txt;'
+        oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
+        trace = logdir + '/log_' + host + case + test + '_3.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'FATAL', 30)
+        oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
 
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -72,12 +72,13 @@ def execute(oai, user, pw, logfile,logdir):
     
     try:
         test = '01'
-        name = 'Run oai.dlsim.test1'
+        name = 'Perf oai.dlsim.test1'
         diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
-        conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test +'.txt'
+        conf = '-m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test +'.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -85,12 +86,13 @@ def execute(oai, user, pw, logfile,logdir):
         
     try:
         test = '06'
-        name = 'Run oai.dlsim.test5'
+        name = 'Perf oai.dlsim.test5'
         diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
-        conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, ' effective rate passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -98,12 +100,13 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '06'
-        name = 'Run oai.dlsim.test6'
+        name = 'Perf oai.dlsim.test6'
         diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
-        conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -111,12 +114,13 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '06b'
-        name = 'Run oai.dlsim.test6b'
+        name = 'Perf oai.dlsim.test6b'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
-        conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -124,12 +128,13 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '07'
-        name = 'Run oai.dlsim.test7'
+        name = 'Perf oai.dlsim.test7'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
-        conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -138,12 +143,13 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '07b'
-        name = 'Run oai.dlsim.test7b'
+        name = 'Perf oai.dlsim.test7b'
         diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)'
-        conf = '-m14 -gG -s-1 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m14 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -151,12 +157,13 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '10'
-        name = 'Run oai.dlsim.test10'
+        name = 'Perf oai.dlsim.test10'
         diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
-        conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -164,12 +171,13 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '10b'
-        name = 'Run oai.dlsim.test10b'
+        name = 'Perf oai.dlsim.test10b'
         diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
-        conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -177,12 +185,13 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '11'
-        name = 'Run oai.dlsim.test11'
+        name = 'Perf oai.dlsim.test11'
         diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
-        conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
diff --git a/targets/TEST/OAI/case05.py b/targets/TEST/OAI/case05.py
index 9852fbd350059af1fb71d3047e73cf38422738f8..46f50bba879303cd0fb8f84e39dc5a3735f820e9 100644
--- a/targets/TEST/OAI/case05.py
+++ b/targets/TEST/OAI/case05.py
@@ -44,7 +44,7 @@ NUM_UE=2
 NUM_eNB=1
 NUM_TRIALS=3
 
-def execute(oai, user, pw, logfile,logdir):
+def execute(oai, user, pw, host,logfile,logdir,debug):
     
     case = '04'
     oai.send('cd $OPENAIR1_DIR;')     
@@ -52,18 +52,18 @@ def execute(oai, user, pw, logfile,logdir):
     
     try:
         test = '00'
-        name = 'Run oai.dlsim.sanity'
+        name = 'Perf oai.dlsim.sanity'
         conf = '-a -A AWGN -n 100'
         diag = 'ulsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
-        trace = logdir + '/log_' + case + test + '_1.txt;'
+        trace = logdir + '/log_' + host + case + test + '_1.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Segmentation fault', 30)
-        trace = logdir + '/log_' + case + test + '_2.txt;'
+        oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
+        trace = logdir + '/log_' + host + case + test + '_2.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Exiting', 30)
-        trace = logdir + '/log_' + case + test + '_3.txt;'
+        oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
+        trace = logdir + '/log_' + host + case + test + '_3.txt;'
         tee = ' 2>&1 | tee ' + trace
-        oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'FATAL', 30)
+        oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
 
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
@@ -72,13 +72,14 @@ def execute(oai, user, pw, logfile,logdir):
     
     try:
         test = '01'
-        name = 'Run oai.ulsim.test1'
+        name = 'Perf oai.ulsim.test1'
         diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
-        conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test +'.txt'
+        conf = '-m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test +'.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -86,13 +87,14 @@ def execute(oai, user, pw, logfile,logdir):
         
     try:
         test = '06'
-        name = 'Run oai.ulsim.test5'
+        name = 'Perf oai.ulsim.test5'
         diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
-        conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -100,13 +102,14 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '06'
-        name = 'Run oai.ulsim.test6'
+        name = 'Perf oai.ulsim.test6'
         diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
-        conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -114,13 +117,14 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '06b'
-        name = 'Run oai.ulsim.test6b'
+        name = 'Perf oai.ulsim.test6b'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
-        conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -128,13 +132,14 @@ def execute(oai, user, pw, logfile,logdir):
   
     try:
         test = '07'
-        name = 'Run oai.ulsim.test7'
+        name = 'Perf oai.ulsim.test7'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
-        conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -142,13 +147,14 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '10'
-        name = 'Run oai.ulsim.test10'
+        name = 'Perf oai.ulsim.test10'
         diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
-        conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -156,13 +162,14 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '10b'
-        name = 'Run oai.ulsim.test10b'
+        name = 'Perf oai.ulsim.test10b'
         diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
-        conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
@@ -170,13 +177,14 @@ def execute(oai, user, pw, logfile,logdir):
 
     try:
         test = '11'
-        name = 'Run oai.ulsim.test11'
+        name = 'Perf oai.ulsim.test11'
         diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
-        conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
-        trace = logdir + '/log_' + case + test + '.txt'
+        conf = '-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
+        trace = logdir + '/log_' + host + case + test + '.txt'
         tee = ' 2>&1 | tee ' + trace
-        print test + 'not performed'
-        #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
+        #print test + 'not performed'
+        cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
+        oai.send_expect(cmd, 'passed', 150)
     except log.err, e:
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py
index a95003b2e6c912833af354ec9bcc849f42f9303f..647c1c4dd0128bfe4d8904464cdf9835f0e00833 100644
--- a/targets/TEST/OAI/test01.py
+++ b/targets/TEST/OAI/test01.py
@@ -78,13 +78,14 @@ for arg in sys.argv:
     i= i + 1     
 
 # get the oai object
+host = os.uname()[1]
 oai = openair('localdomain','localhost')
 #start_time = time.time()  # datetime.datetime.now()
 try: 
     user = getpass.getuser()
     print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
     print '******* Connecting to the localhost to perform the test *******\n'
-    print '******* Make sure that the prompt is correct *******\n'
+   
    
     if not pw :
         print "username: " + user 
@@ -94,7 +95,7 @@ try:
         #print "password: " + pw 
     
     prompt = os.getenv("PS1")[-2]
-    print "your prompt:   " + prompt
+    print "your prompt is:   " + prompt
     
     oai.connect(user,pw,prompt)
     #oai.get_shell()
@@ -106,9 +107,11 @@ except :
 test = 'test01'
 ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
 logfile = user+'.'+test+'.'+ctime+'.txt'  
-logdir = os.getcwd() + '/pre-ci-logs';
-oai.send_nowait('mkdir -p -m 755' + logdir + ';')
-  
+logdir = os.getcwd() + '/pre-ci-logs-'+host;
+oai.create_dir(logdir,debug)    
+print 'log dir: ' + logdir
+#oai.send_nowait('mkdir -p -m 755' + logdir + ';')
+
 #print '=================start the ' + test + ' at ' + ctime + '=================\n'
 #print 'Results will be reported in log file : ' + logfile
 log.writefile(logfile,'====================start'+test+' at ' + ctime + '=======================\n')
@@ -118,12 +121,14 @@ oai.kill(user, pw)
 oai.rm_driver(oai,user,pw)
 
 # start te test cases 
-case01.execute(oai, user, pw, logfile,logdir)
-case02.execute(oai, user, pw, logfile,logdir)
-case03.execute(oai, user, pw, logfile,logdir)
-if dlsim != 0 :
-    case04.execute(oai, user, pw, logfile,logdir)
-    case05.execute(oai, user, pw, logfile,logdir)
+rv=case01.execute(oai, user, pw, host,logfile,logdir,debug)
+if rv != 0 :
+    case02.execute(oai, user, pw, host, logfile,logdir,debug)
+    case03.execute(oai, user, pw, host, logfile,logdir,debug)
+    case04.execute(oai, user, pw, host, logfile,logdir,debug)
+#case05.execute(oai, user, pw, host, logfile,logdir,debug)
+else :
+    print 'Compilation error: skip test case 02,03,04,05'
 
 oai.kill(user, pw) 
 oai.rm_driver(oai,user,pw)
diff --git a/targets/itti_vcd_tasks.sav b/targets/itti_vcd_tasks.sav
index 9883855ae83c3193b0d8da3abad12f321130e6d5..fca66612ac8bbe96829da9f12a9781c06b3ec50a 100644
--- a/targets/itti_vcd_tasks.sav
+++ b/targets/itti_vcd_tasks.sav
@@ -2,7 +2,7 @@
 [*] GTKWave Analyzer v3.3.34 (w)1999-2012 BSI
 [*] Thu Dec 19 10:33:06 2013
 [*]
-[dumpfile] "/tmp/log.vcd"
+[dumpfile] "/tmp/openair_dump_eNB.vcd"
 [dumpfile_mtime] "Thu Dec 19 10:26:58 2013"
 [dumpfile_size] 68919271
 [savefile] "$OPENAIR_TARGETS/itti_vcd_tasks.sav"