diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 7f911528a1814385ba588c516c0298b7395b500f..215f7525d91cd443f761bba953263dbea3ded88b 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1886,7 +1886,7 @@ add_definitions(-DASN1_MINIMUM_VERSION=924)
 add_executable(lte-softmodem
   ${rrc_h}
   ${s1ap_h}
-#  ${OPENAIR_BIN_DIR}/messages_xml.h
+  ${OPENAIR_BIN_DIR}/messages_xml.h
   ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
   ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
   ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 94f2ebfe9d5bb3c21cd295402fc46840cdd69f9b..5f804bfabc1688779103bacb8a7512efc3846bed 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -23,6 +23,44 @@
 #include "phy_init.h"
 #include "PHY/phy_extern.h"
 #include "PHY/CODING/coding_extern.h"
+
+void generate_64qam_table(void)
+{
+
+  int a,b,c,index;
+
+
+  for (a=-1; a<=1; a+=2)
+    for (b=-1; b<=1; b+=2)
+      for (c=-1; c<=1; c+=2) {
+        index = (1+a)*2 + (1+b) + (1+c)/2;
+        qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2
+      }
+}
+
+void generate_16qam_table(void)
+{
+
+  int a,b,index;
+
+  for (a=-1; a<=1; a+=2)
+    for (b=-1; b<=1; b+=2) {
+      index = (1+a) + (1+b)/2;
+      qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2));
+    }
+}
+
+void generate_qpsk_table(void)
+{
+
+  int a,index;
+
+  for (a=-1; a<=1; a+=2) {
+    index = (1+a)/2;
+    qpsk_table[index] = -a*QPSK;  
+  }
+}
+
 void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
 {
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
index 5dbf6c10a9447be62169ea80524e444b20f613b3..a27250f7ea32c51221f4caaf1cf1029b66e709ed 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c
@@ -99,6 +99,7 @@ uint16_t RIV2nb_rb_LUT100[6000];
 uint16_t RIV2first_rb_LUT100[6000];
 uint16_t RIV_max100=0;
 
+extern RAN_CONTEXT_t RC;
 
 extern uint32_t current_dlsch_cqi;
 
@@ -163,6 +164,49 @@ int8_t delta_PUSCH_acc[4] = {-1,0,1,3};
 
 int8_t *delta_PUCCH_lut = delta_PUSCH_acc;
 
+uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
+{
+  /*
+  MIMO_mode_t mode   = dlsch_harq->mimo_mode;
+  uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
+  */
+
+  switch (N_RB_DL) {
+    case 6:   // 1 PRB per subband
+      if (mode <= PUSCH_PRECODING1)
+        return((pmi_alloc>>(rb<<1))&3);
+      else
+        return((pmi_alloc>>rb)&1);
+
+      break;
+
+    default:
+    case 25:  // 4 PRBs per subband
+      if (mode <= PUSCH_PRECODING1)
+        return((pmi_alloc>>((rb>>2)<<1))&3);
+      else
+        return((pmi_alloc>>(rb>>2))&1);
+
+      break;
+
+    case 50: // 6 PRBs per subband
+      if (mode <= PUSCH_PRECODING1)
+        return((pmi_alloc>>((rb/6)<<1))&3);
+      else
+        return((pmi_alloc>>(rb/6))&1);
+
+      break;
+
+    case 100: // 8 PRBs per subband
+      if (mode <= PUSCH_PRECODING1)
+        return((pmi_alloc>>((rb>>3)<<1))&3);
+      else
+        return((pmi_alloc>>(rb>>3))&1);
+
+      break;
+  }
+}
+
 uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi)
 {
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index 9ade420ccf173315dfed8d07f0dcc38b617739e9..c1112b8e02ce853aeff99983e9ee6133439464e4 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -94,42 +94,7 @@ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp,
   return(0);
 }
 
-void generate_64qam_table(void)
-{
-
-  int a,b,c,index;
-
-
-  for (a=-1; a<=1; a+=2)
-    for (b=-1; b<=1; b+=2)
-      for (c=-1; c<=1; c+=2) {
-        index = (1+a)*2 + (1+b) + (1+c)/2;
-        qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2
-      }
-}
-
-void generate_16qam_table(void)
-{
-
-  int a,b,index;
 
-  for (a=-1; a<=1; a+=2)
-    for (b=-1; b<=1; b+=2) {
-      index = (1+a) + (1+b)/2;
-      qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2));
-    }
-}
-
-void generate_qpsk_table(void)
-{
-
-  int a,index;
-
-  for (a=-1; a<=1; a+=2) {
-    index = (1+a)/2;
-    qpsk_table[index] = -a*QPSK;  
-  }
-}
 
 
 
@@ -1969,48 +1934,6 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
   return(0);
 }
 
-uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
-{
-  /*
-  MIMO_mode_t mode   = dlsch_harq->mimo_mode;
-  uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
-  */
-
-  switch (N_RB_DL) {
-    case 6:   // 1 PRB per subband
-      if (mode <= PUSCH_PRECODING1)
-        return((pmi_alloc>>(rb<<1))&3);
-      else
-        return((pmi_alloc>>rb)&1);
-
-      break;
-
-    default:
-    case 25:  // 4 PRBs per subband
-      if (mode <= PUSCH_PRECODING1)
-        return((pmi_alloc>>((rb>>2)<<1))&3);
-      else
-        return((pmi_alloc>>(rb>>2))&1);
-
-      break;
-
-    case 50: // 6 PRBs per subband
-      if (mode <= PUSCH_PRECODING1)
-        return((pmi_alloc>>((rb/6)<<1))&3);
-      else
-        return((pmi_alloc>>(rb/6))&1);
-
-      break;
-
-    case 100: // 8 PRBs per subband
-      if (mode <= PUSCH_PRECODING1)
-        return((pmi_alloc>>((rb>>3)<<1))&3);
-      else
-        return((pmi_alloc>>(rb>>3))&1);
-
-      break;
-  }
-}
 
 
 inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) __attribute__((always_inline));
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 507c765b6b1815d1b37c904a7c3ad0cf9c515751..83e7f74c76de74fb1ab9bf2367a23734c3bba7bc 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -72,6 +72,20 @@ void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch);
 
 LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
 
+int dlsch_encoding_all(PHY_VARS_eNB *eNB,
+		       unsigned char *a,
+		       uint8_t num_pdcch_symbols,
+		       LTE_eNB_DLSCH_t *dlsch,
+		       int frame,
+		       uint8_t subframe,
+		       time_stats_t *rm_stats,
+		       time_stats_t *te_stats,
+		       time_stats_t *te_wait_stats,
+		       time_stats_t *te_main_stats,
+		       time_stats_t *te_wakeup_stats0,
+		       time_stats_t *te_wakeup_stats1,
+		       time_stats_t *i_stats);
+
 /** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
     uint8_t *input_buffer,
     LTE_DL_FRAME_PARMS *frame_parms,
diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h
index 79c12f8a5cdff73676ab629d6475b6430f7840b2..78e1ab2c0f5f8c0c880aa38f74f7b7c1252d3fda 100644
--- a/openair1/PHY/defs_eNB.h
+++ b/openair1/PHY/defs_eNB.h
@@ -339,7 +339,7 @@ typedef struct RU_t_s{
   void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
 #endif
   /// function pointer to eNB entry routine
-  void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string);
+  void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
   /// Timing statistics
   time_stats_t ofdm_demod_stats;
   /// Timing statistics (TX)
@@ -634,6 +634,8 @@ typedef struct {
   pthread_mutex_t mutex_rxtx;
   /// scheduling parameters for RXn-TXnp4 thread
   struct sched_param sched_param_rxtx;
+  /// pipeline ready state
+  int pipe_ready;
 } eNB_rxtx_proc_t;
 
 typedef struct {
diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h
index 2728e068b9cd2f8d0edf298a51c5e97960e652b1..c323d1eade612f6a3173ba5848322fefa2f5d117 100644
--- a/openair1/PHY/phy_vars_ue.h
+++ b/openair1/PHY/phy_vars_ue.h
@@ -23,7 +23,9 @@
 #define __PHY_VARS_H__
 
 #include "PHY/types.h"
-#include "PHY/defs.h"
+#include "PHY/defs_UE.h"
+#include "PHY/phy_vars_ue.h"
+
 #include "common/ran_context.h"
 
 char* namepointer_chMag ;
@@ -37,7 +39,7 @@ int16_t *primary_synch1_time;
 int16_t *primary_synch2_time;
 
 
-#include "PHY/CODING/vars.h"
+#include "PHY/CODING/coding_vars.h"
 
 //PHY_VARS *PHY_vars;
 #ifndef OCP_FRAMEWORK
@@ -54,7 +56,6 @@ unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048]
 
 
 char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
-#include "PHY/LTE_TRANSPORT/vars.h"
 
 
 
diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c
index 2274eb467d09e76dc9fa5cbdc87b6f85693600d7..4aa44c21adb5f0cb71882cb93aa42fcfcf3311b8 100644
--- a/openair1/SCHED/phy_procedures_lte_common.c
+++ b/openair1/SCHED/phy_procedures_lte_common.c
@@ -31,6 +31,7 @@
 */
 #include "PHY/defs_eNB.h"
 #include "PHY/defs_UE.h"
+#include "SCHED/sched_common_extern.h"
 
 void get_Msg3_alloc(LTE_DL_FRAME_PARMS *frame_parms,
                     unsigned char current_subframe,
@@ -1059,3 +1060,73 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri
 	
       }
 }
+
+// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id,
+int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs)
+{
+
+  /// The payload + CRC size in bits, "B"
+  uint32_t B;
+  /// Number of code segments
+  uint32_t C;
+  /// Number of "small" code segments
+  uint32_t Cminus;
+  /// Number of "large" code segments
+  uint32_t Cplus;
+  /// Number of bits in "small" code segments (<6144)
+  uint32_t Kminus;
+  /// Number of bits in "large" code segments (<6144)
+  uint32_t Kplus;
+  /// Total number of bits across all segments
+  uint32_t sumKr;
+  /// Number of "Filler" bits
+  uint32_t F;
+  // num resource elements
+  uint32_t num_re=0.0;
+  // num symbols
+  uint32_t num_symb=0.0;
+  /// effective spectral efficiency of the PUSCH
+  uint32_t MPR_x100=0;
+  /// beta_offset
+  uint16_t beta_offset_pusch_x8=8;
+  /// delta mcs
+  float delta_mcs=0.0;
+  /// bandwidth factor
+  float bw_factor=0.0;
+
+  B= tbs+24;
+  lte_segmentation(NULL,
+                   NULL,
+                   B,
+                   &C,
+                   &Cplus,
+                   &Cminus,
+                   &Kplus,
+                   &Kminus,
+                   &F);
+
+
+  sumKr = Cminus*Kminus + Cplus*Kplus;
+  num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
+  num_re = num_symb * nb_rb * 12;
+
+  if (num_re == 0)
+    return(0);
+
+  MPR_x100 = 100*sumKr/num_re;
+
+  if (control_only == 1 )
+    beta_offset_pusch_x8=8; // fixme
+
+  //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
+
+  // if deltamcs_enabledm
+  delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
+  bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0);
+#ifdef DEBUG_SEGMENTATION
+  printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
+         (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
+#endif
+  return (int16_t)ceil(delta_mcs + bw_factor);
+
+}
diff --git a/openair1/SCHED_UE/pusch_pc.c b/openair1/SCHED_UE/pusch_pc.c
index ad741d47c0ec71a9443ebabef0b783313a06bdf6..a597a95f202b0edefcdfa8823059d11c4f7ad860 100644
--- a/openair1/SCHED_UE/pusch_pc.c
+++ b/openair1/SCHED_UE/pusch_pc.c
@@ -132,72 +132,4 @@ int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index)
   return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR;
 }
 
-// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id,
-int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs)
-{
-
-  /// The payload + CRC size in bits, "B"
-  uint32_t B;
-  /// Number of code segments
-  uint32_t C;
-  /// Number of "small" code segments
-  uint32_t Cminus;
-  /// Number of "large" code segments
-  uint32_t Cplus;
-  /// Number of bits in "small" code segments (<6144)
-  uint32_t Kminus;
-  /// Number of bits in "large" code segments (<6144)
-  uint32_t Kplus;
-  /// Total number of bits across all segments
-  uint32_t sumKr;
-  /// Number of "Filler" bits
-  uint32_t F;
-  // num resource elements
-  uint32_t num_re=0.0;
-  // num symbols
-  uint32_t num_symb=0.0;
-  /// effective spectral efficiency of the PUSCH
-  uint32_t MPR_x100=0;
-  /// beta_offset
-  uint16_t beta_offset_pusch_x8=8;
-  /// delta mcs
-  float delta_mcs=0.0;
-  /// bandwidth factor
-  float bw_factor=0.0;
-
-  B= tbs+24;
-  lte_segmentation(NULL,
-                   NULL,
-                   B,
-                   &C,
-                   &Cplus,
-                   &Cminus,
-                   &Kplus,
-                   &Kminus,
-                   &F);
-
-
-  sumKr = Cminus*Kminus + Cplus*Kplus;
-  num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
-  num_re = num_symb * nb_rb * 12;
-
-  if (num_re == 0)
-    return(0);
-
-  MPR_x100 = 100*sumKr/num_re;
 
-  if (control_only == 1 )
-    beta_offset_pusch_x8=8; // fixme
-
-  //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
-
-  // if deltamcs_enabledm
-  delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
-  bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0);
-#ifdef DEBUG_SEGMENTATION
-  printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
-         (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
-#endif
-  return (int16_t)ceil(delta_mcs + bw_factor);
-
-}
diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c
index 5ef18f5bdad0c2b4917d943824c9cae3f1c90430..cac3323b0c8fb4d19229df143e5d009156bc0b7e 100644
--- a/openair2/LAYER2/MAC/config_ue.c
+++ b/openair2/LAYER2/MAC/config_ue.c
@@ -32,7 +32,7 @@
 
 #include "COMMON/platform_types.h"
 #include "COMMON/platform_constants.h"
-#include "SCHED/defs.h"
+#include "SCHED_UE/sched_UE.h"
 #include "SystemInformationBlockType2.h"
 //#include "RadioResourceConfigCommonSIB.h"
 #include "RadioResourceConfigDedicated.h"
@@ -43,9 +43,9 @@
 #include "MeasObjectToAddModList.h"
 #include "TDD-Config.h"
 #include "MAC-MainConfig.h"
-#include "defs.h"
-#include "proto.h"
-#include "extern.h"
+#include "mac.h"
+#include "mac_proto.h"
+#include "mac_extern.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
index e6258593245ea368c65d386e26dc6cc0aa5a362f..9532222fb8a7359ae988e3cb2ab546f8fb782901 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
@@ -30,22 +30,21 @@
  */
 
 #include "assertions.h"
-#include "PHY/defs.h"
-#include "PHY/extern.h"
+#include "PHY/defs_eNB.h"
+#include "PHY/phy_extern.h"
 
-#include "SCHED/defs.h"
-#include "SCHED/extern.h"
+#include "SCHED/sched_eNB.h"
 
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/proto.h"
-#include "LAYER2/MAC/extern.h"
+#include "LAYER2/MAC/mac.h"
+#include "LAYER2/MAC/mac_proto.h"
+#include "LAYER2/MAC/mac_extern.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 #include "OCG.h"
 #include "OCG_extern.h"
 
-#include "SIMULATION/TOOLS/defs.h" // for taus
+#include "SIMULATION/TOOLS/sim.h" // for taus
 
 #include "T.h"
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 08beb411142cc6fc1faf813a22cf9f507b2d3a1b..6a11c776180884607392dbd87811f5636df7753b 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -983,6 +983,8 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP,
 	      cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present);
 }
 
+
+
 void
 fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
 		     uint8_t                       aggregation_level,
diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c
index 64326dec614dc9ea452c7ce7bebf73692050167b..272ca5cddd7c953ed87bc458f9018451c161d0f1 100644
--- a/openair2/LAYER2/MAC/main_ue.c
+++ b/openair2/LAYER2/MAC/main_ue.c
@@ -29,20 +29,18 @@
 
  */
 
-#include "defs.h"
-#include "proto.h"
-#include "extern.h"
+#include "mac.h"
+#include "mac_proto.h"
+#include "mac_extern.h"
 #include "assertions.h"
-#include "PHY_INTERFACE/extern.h"
-#include "PHY/defs.h"
-#include "SCHED/defs.h"
+#include "PHY_INTERFACE/phy_interface_extern.h"
+#include "PHY/defs_UE.h"
+#include "SCHED_UE/sched_UE.h"
 #include "LAYER2/PDCP_v10.1.0/pdcp.h"
-#include "RRC/LITE/defs.h"
+#include "RRC/LTE/rrc_defs.h"
 #include "UTIL/LOG/log.h"
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 
-#include "SCHED/defs.h"
-
 
 #include "common/ran_context.h"
 
diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index 4f33089353a582706806e89e3a9896c4405f4ed1..4a2a7d35f08a4c9571ae18a916e1d251a54f50f7 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -30,24 +30,20 @@
  * \warning
  */
 
-#include "extern.h"
-#include "defs.h"
-#include "proto.h"
+#include "mac_extern.h"
+#include "mac.h"
+#include "mac_proto.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
-#include "PHY_INTERFACE/extern.h"
-#include "SCHED/defs.h"
+#include "PHY_INTERFACE/phy_interface_extern.h"
+#include "SCHED_UE/sched_UE.h"
 #include "COMMON/mac_rrc_primitives.h"
-#include "RRC/LITE/extern.h"
+#include "RRC/LTE/rrc_extern.h"
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/OPT/opt.h"
 #include "OCG.h"
 #include "OCG_extern.h"
-#ifdef PHY_EMUL
-#include "SIMULATION/simulation_defs.h"
-#endif
-
-#include "SIMULATION/TOOLS/defs.h"	// for taus
+#include "SIMULATION/TOOLS/sim.h"	// for taus
 
 /// This routine implements Section 5.1.2 (UE Random Access Resource Selection) from 36.321
 void
diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c
index ab193c7a66b2422473dd208af125fc815c4a7259..7d24e4c0af31c5fd2a87ea13ec06427f08902d6f 100644
--- a/openair2/LAYER2/MAC/rar_tools_ue.c
+++ b/openair2/LAYER2/MAC/rar_tools_ue.c
@@ -28,10 +28,10 @@
 
  */
 
-#include "defs.h"
-#include "proto.h"
-#include "extern.h"
-#include "SIMULATION/TOOLS/defs.h"
+#include "mac.h"
+#include "mac_proto.h"
+#include "mac_extern.h"
+#include "SIMULATION/TOOLS/sim.h"
 #include "UTIL/LOG/log.h"
 #include "OCG.h"
 #include "OCG_extern.h"
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 5ca6d10bb530f4ac19246777c488a24d6c8f3b4e..16a7a373c71cc767782b47231cbd44fdd972d965 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -33,29 +33,21 @@
 #include <pthread.h>
 #endif
 
-#include "extern.h"
-#include "defs.h"
-#include "proto.h"
-#ifdef PHY_EMUL
-#include "SIMULATION/PHY_EMULATION/impl_defs.h"
-#else
-#include "SCHED/defs.h"
+#include "mac_extern.h"
+#include "mac.h"
+#include "mac_proto.h"
+#include "SCHED_UE/sched_UE.h"
 #include "PHY/impl_defs_top.h"
-#endif
-#include "PHY_INTERFACE/extern.h"
+#include "PHY_INTERFACE/phy_interface_extern.h"
 #include "COMMON/mac_rrc_primitives.h"
 
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-#include "RRC/LITE/extern.h"
+#include "RRC/LTE/rrc_extern.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 #include "OCG.h"
 #include "OCG_extern.h"
-
-#ifdef PHY_EMUL
-#include "SIMULATION/simulation_defs.h"
-#endif
 #include "pdcp.h"
 
 #if defined(ENABLE_ITTI)
@@ -64,7 +56,7 @@
 
 #include "assertions.h"
 
-#include "SIMULATION/TOOLS/defs.h"	// for taus
+#include "SIMULATION/TOOLS/sim.h"	// for taus
 
 #define DEBUG_HEADER_PARSING 1
 #define ENABLE_MAC_PAYLOAD_DEBUG 1
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
index 5130bde38b9f32f6a8d3b18c6d4d8e139c388c84..040145f7f03c1da8db15b77f979d0c155ef9e1cf 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
@@ -71,6 +71,7 @@
 #        include "rlc_am_reassembly.h"
 #        include "rlc_am_init.h"
 #        include "RLC-Config.h"
+#        include "assertions.h"
 //#        include "rlc_am_test.h"
 
 
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 4c07b9ec7a873dcbdf38cfb540ffadee7e7d25e3..71072cc03e389fc1497b371251c93d0bd7957d9a 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -81,15 +81,8 @@
 
 #include "SIMULATION/TOOLS/sim.h" // for taus
 
-
-#ifdef PHY_EMUL
-extern EMULATION_VARS *Emul_vars;
-#endif
-extern eNB_MAC_INST *eNB_mac_inst;
-extern UE_MAC_INST *UE_mac_inst;
-#ifdef BIGPHYSAREA
-extern void *bigphys_malloc(int);
-#endif
+// for malloc_clear
+#include "PHY/defs_UE.h"
 
 //#define XER_PRINT
 
diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
index e5f2c5aaae1c469c4da1ffbcda1a41a0d7c264d4..135c6fea8d82e5279036ad7c11ae08df8d3d8683 100644
--- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
@@ -28,9 +28,9 @@
  */
 
 #if defined(ENABLE_USE_MME)
-# include "defs.h"
-# include "extern.h"
-# include "RRC/LITE/MESSAGES/asn1_msg.h"
+# include "rrc_defs.h"
+# include "rrc_extern.h"
+# include "RRC/LTE/MESSAGES/asn1_msg.h"
 # include "rrc_eNB_GTPV1U.h"
 # include "rrc_eNB_UE_context.h"
 # include "msc.h"
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 80ae1c9ba57e9e276f5f4581c6dea7c9c7e49bec..130574041c37f861919d0991bf85504064bf5ea5 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -27,13 +27,11 @@
  * \company Eurecom
  * \email: navid.nikaein@eurecom.fr
  */
-
 #if defined(ENABLE_USE_MME)
-# include "defs.h"
-# include "extern.h"
+# include "rrc_defs.h"
+# include "rrc_extern.h"
 # include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-# include "RRC/LITE/MESSAGES/asn1_msg.h"
-# include "RRC/LITE/defs.h"
+# include "RRC/LTE/MESSAGES/asn1_msg.h"
 # include "rrc_eNB_UE_context.h"
 # include "rrc_eNB_S1AP.h"
 # include "enb_config.h"
@@ -57,7 +55,7 @@
 #include "UERadioAccessCapabilityInformation.h"
 
 #include "gtpv1u_eNB_task.h"
-#include "RRC/LITE/rrc_eNB_GTPV1U.h"
+#include "RRC/LTE/rrc_eNB_GTPV1U.h"
 
 #include "TLVDecoder.h"
 #include "S1ap-NAS-PDU.h"
diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c
index bd36511b524a093504730643748f55bea95254ff..db531b0e9ddd73294530a337909d04c8878039fd 100644
--- a/targets/COMMON/create_tasks_ue.c
+++ b/targets/COMMON/create_tasks_ue.c
@@ -36,7 +36,7 @@
 #     include "lteRALue.h"
 #     include "lteRALenb.h"
 #   endif
-#   include "RRC/LITE/defs.h"
+#   include "RRC/LTE/rrc_defs.h"
 # endif
 # include "enb_app.h"
 
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index 9f4f62ccdef479a2784cc2fbaefd2677153af996..d6b92c90414bc94f4c2efac10e7a2da17b280b56 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -323,7 +323,7 @@ static void* tx_thread(void* param) {
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,proc->frame_tx);
     VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,proc->frame_rx);
     
-    phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
+    phy_procedures_eNB_TX(eNB, proc, 1);
     if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
 	
     pthread_mutex_lock( &proc->mutex_rxtx );
@@ -406,7 +406,7 @@ static void* eNB_thread_rxtx( void* param ) {
     if(get_nprocs() >= 8)      wakeup_tx(eNB,eNB->proc.ru_proc);
     else
     {  
-      phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
+      phy_procedures_eNB_TX(eNB, proc, 1);
       wakeup_txfh(proc,eNB->proc.ru_proc);
     }
 
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 80e386b04a1ceaa2cd5c5e29a0cacec537e90f37..fa0a1d82611efc8c4b04688ce7fec397aa65e98f 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -140,7 +140,8 @@ static int8_t                     threequarter_fs=0;
 uint32_t                 downlink_frequency[MAX_NUM_CCs][4];
 int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
 
-
+// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB)
+int16_t dlsch_demod_shift = 0;
 
 #if defined(ENABLE_ITTI)
 static char                    *itti_dump_file = NULL;
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 2c83ea9a04e22671ba45fd6ced7b1ddbbc0656fe..b2ace74474b91ffaf53ed931b74fa158d4eddc46 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -33,19 +33,16 @@
 
 #include "rt_wrapper.h"
 
-#ifdef OPENAIR2
-#include "LAYER2/MAC/defs.h"
-#include "RRC/LITE/extern.h"
-#endif
-#include "PHY_INTERFACE/extern.h"
+#include "LAYER2/MAC/mac.h"
+#include "RRC/LTE/rrc_extern.h"
+#include "PHY_INTERFACE/phy_interface_extern.h"
 
 #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
 //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
 
-#include "PHY/extern.h"
-#include "SCHED/extern.h"
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/proto.h"
+#include "PHY/phy_extern_ue.h"
+#include "LAYER2/MAC/mac_extern.h"
+#include "LAYER2/MAC/mac_proto.h"
 
 #include "UTIL/LOG/log_extern.h"
 #include "UTIL/OTG/otg_tx.h"
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index 349dd3afb55458fdd7de2b13ce5554167fd404bc..c3a5207c2400a21ce90bce2b0f20c8f8b5504971 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -47,7 +47,7 @@
 
 #include "PHY/types.h"
 
-#include "PHY/defs.h"
+#include "PHY/defs_UE.h"
 #include "common/ran_context.h"
 #include "common/config/config_userapi.h"
 #include "common/utils/load_module_shlib.h"
@@ -59,22 +59,18 @@
 
 //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
 
-#include "PHY/vars.h"
-#include "SCHED/vars.h"
-#include "LAYER2/MAC/vars.h"
-
+#include "PHY/phy_vars_ue.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
+#include "SCHED/sched_common_vars.h"
+#include "PHY/MODULATION/modulation_vars.h"
 #include "../../SIMU/USER/init_lte.h"
 
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "LAYER2/MAC/proto.h"
-#include "RRC/LITE/vars.h"
-#include "PHY_INTERFACE/vars.h"
+#include "LAYER2/MAC/mac.h"
+#include "LAYER2/MAC/mac_vars.h"
+#include "LAYER2/MAC/mac_proto.h"
+#include "RRC/LTE/rrc_vars.h"
+#include "PHY_INTERFACE/phy_interface_vars.h"
 
-#ifdef SMBV
-#include "PHY/TOOLS/smbv.h"
-unsigned short config_frames[4] = {2,9,11,13};
-#endif
 #include "UTIL/LOG/log_extern.h"
 #include "UTIL/OTG/otg_tx.h"
 #include "UTIL/OTG/otg_externs.h"
@@ -101,6 +97,8 @@ unsigned short config_frames[4] = {2,9,11,13};
 #endif
 #include "lte-softmodem.h"
 
+RAN_CONTEXT_t RC;
+
 /* temporary compilation wokaround (UE/eNB split */
 uint16_t sf_ahead;
 #ifdef XFORMS
@@ -386,7 +384,7 @@ static void *scope_thread(void *arg) {
 #endif
 
   while (!oai_exit) {
-      dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
+    //      dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
       //fl_set_object_label(form_stats->stats_text, stats_buffer);
       fl_clear_browser(form_stats->stats_text);
       fl_add_browser_line(form_stats->stats_text, stats_buffer);
diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h
index 6f0aa0a6eb5ea8840a6b587bd7f18d6563d251b3..fee6c974b84d0e7c2c5761eaae24e7c7a51e1d2d 100644
--- a/targets/SIMU/USER/init_lte.h
+++ b/targets/SIMU/USER/init_lte.h
@@ -20,7 +20,7 @@
  */
 
 #include "PHY/types.h"
-#include "PHY/defs.h"
+#include "PHY/defs_eNB.h"
 
 PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
                            uint8_t eNB_id,
@@ -32,10 +32,6 @@ PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
                          uint8_t UE_id,
                          uint8_t abstraction_flag);
 
-PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
-                         uint8_t RN_id,
-                         uint8_t eMBMS_active_state);
-
 void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
                    uint8_t frame_type,
                    uint8_t tdd_config,