diff --git a/common/platform_constants.h b/common/platform_constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d67b76cd7fda46fce6c1350d7313b9698f59d10
--- /dev/null
+++ b/common/platform_constants.h
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*
+                                 platform_constants.h
+                             -------------------
+  AUTHOR  : Lionel GAUTHIER and Navid Nikaein
+  COMPANY : EURECOM
+  EMAIL   : Lionel.Gauthier@eurecom.fr
+
+ ***************************************************************************/
+
+#ifndef __PLATFORM_CONSTANTS_H__
+#define __PLATFORM_CONSTANTS_H__
+#include "LTE_asn_constant.h"
+#include "NR_asn_constant.h"
+#define NR_MAXDRB 14
+
+#ifdef JUMBO_FRAME
+#define NL_MAX_PAYLOAD 18000 /* this should cover the max mtu size*/
+#else
+#define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/
+#endif
+
+#ifdef LARGE_SCALE
+#define NB_MODULES_MAX 128
+#define NB_NODE_MAX 128
+#else
+#define NB_MODULES_MAX 32
+#define NB_NODE_MAX 32
+#endif
+
+#ifdef JUMBO_FRAME
+#define MAX_IP_PACKET_SIZE 10000 // 9000
+#else
+#if defined(OAI_NW_DRIVER_TYPE_ETHERNET)
+/* SR: When using ethernet network driver the packet size is 1512 :
+ * 1500 bytes IP packet + 14 bytes ethernet header
+ */
+#define MAX_IP_PACKET_SIZE 1514
+#else
+#define MAX_IP_PACKET_SIZE 1500 // 3000
+#endif
+#endif
+// overwrite the previous deinitions
+
+#define MAX_MODULES NB_MODULES_MAX
+#define MAX_NR_RRC_UE_CONTEXTS 64
+
+#ifndef UE_EXPANSION
+#ifdef LARGE_SCALE
+#define MAX_MOBILES_PER_ENB 128
+#define MAX_MOBILES_PER_ENB_NB_IoT 128
+#define MAX_MOBILES_PER_GNB 128
+#define MAX_eNB 2
+#define MAX_gNB 2
+#else
+#define MAX_MOBILES_PER_ENB 40
+#define MAX_MOBILES_PER_ENB_NB_IoT 40
+#define MAX_MOBILES_PER_GNB 16
+#define MAX_eNB 2
+#define MAX_gNB 2
+#endif
+#else
+#define MAX_MOBILES_PER_ENB 256
+#define MAX_MOBILES_PER_ENB_NB_IoT 256
+#define MAX_MOBILES_PER_GNB 256
+#define MAX_eNB 2
+#define MAX_gNB 2
+#endif
+
+#define NUMBER_OF_NR_UCI_STATS_MAX 16
+#define MAX_MANAGED_ENB_PER_MOBILE 2
+#define MAX_MANAGED_GNB_PER_MOBILE 2
+
+/// NB-IOT
+#define NB_RB_MAX_NB_IOT (LTE_maxDRB_NB_r13 + 3) // MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5
+
+#define DEFAULT_RAB_ID 1
+
+#define NB_RB_MAX (LTE_maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
+#define NR_NB_RB_MAX (NR_maxDRB + 3)
+
+#define NGAP_MAX_PDU_SESSION (256) /* As defined in TS 38.413 9.2.1.1 Range Bound for PDU Sessions. */
+#define NGAP_MAX_DRBS_PER_UE (32) /* As defined in TS 38.413 9.2.1.1 - maxnoofDRBs */
+
+#define NB_RB_MBMS_MAX (LTE_maxSessionPerPMCH * LTE_maxServiceCount)
+
+#define NB_RAB_MAX LTE_maxDRB /* was 8, now 11 */
+#define RAB_SHIFT1 9
+#define RAB_SHIFT2 3
+//#define RAB_OFFSET     0x0007
+#define RAB_OFFSET 0x000F
+#define RAB_OFFSET1 0x7E00
+#define RAB_OFFSET2 0x01F8
+#define DIR_OFFSET 0x8000
+#define DIR_SHIFT 15
+#define CH_OFFSET 0x0004
+#define CH_SHIFT 2
+
+// RLC Entity
+#define RLC_TX_MAXSIZE       10000000
+#define RLC_RX_MAXSIZE       10000000
+
+// RLC_AM_SEND_MRW
+#define SEND_MRW_OFF 15
+#define SEND_MRW_ON 240
+
+// RLC_SEGMENTATION_INDICATION
+#define SEGMENTATION_NOT_ALLOWED 0
+#define SEGMENTATION_ALLOWED 1
+
+// RLC_DELIVERY_OF_ERRONEOUS_SDU
+#define DELIVERY_OF_ERRONEOUS_SDU_NO 0
+#define DELIVERY_OF_ERRONEOUS_SDU_YES 1
+#define DELIVERY_OF_ERRONEOUS_SDU_NO_DETECT 2
+
+// CBA constant
+#define NUM_MAX_CBA_GROUP 4
+
+#ifndef __cplusplus
+#ifndef NULL
+#define NULL 0
+#endif
+#ifndef null
+#define null 0
+#endif
+#endif
+
+#define UNUSED_PARAM_MBMS_SESSION_ID 0
+#define UNUSED_PARAM_MBMS_SERVICE_ID 0
+
+#define printk printf
+
+#define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE)
+
+#endif /* __PLATFORM_CONSTANTS_H__ */
diff --git a/common/ran_context.h b/common/ran_context.h
index ae8d5b02c462c1179f35aa7d2feb74f098832501..320d431e73574005fcc5f3c6c3eb1cd92aa6877a 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -34,7 +34,7 @@
 #define __RAN_CONTEXT_H__
 
 #include <pthread.h>
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "PHY/defs_eNB.h"
 #include "PHY/types.h"
 #include "PHY/impl_defs_top.h"
@@ -111,4 +111,5 @@ typedef struct {
 
 extern RAN_CONTEXT_t RC;
 
+#define NB_eNB_INST RC.nb_inst
 #endif
diff --git a/common/utils/telnetsrv/telnetsrv_enb_measurements.c b/common/utils/telnetsrv/telnetsrv_enb_measurements.c
index 8830173e6d55272e1d42473ebdb84a7f06e45d8b..b3f52a5e27f4d199ff9b70fa09bad3d03e7d7e0d 100644
--- a/common/utils/telnetsrv/telnetsrv_enb_measurements.c
+++ b/common/utils/telnetsrv/telnetsrv_enb_measurements.c
@@ -165,8 +165,7 @@ void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
     statsptr[i].vptr = rlcstats + i;
   }
 
-  for (int UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
-#define NB_eNB_INST 1
+  for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
     PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_info->eNB_UE_stats[0][UE_id].crnti,
                                    eNB->frame,eNB->subframe,eNB_id);
     measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 5b849ccaa4a9fee30c77f331bdb6f9aaa930f296..ef21662ec979e92752f6bf2caaef5e1d6d67affe 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -2110,7 +2110,6 @@ INPUT                  = \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/nfapi_lte_dummy.c \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/sched_eNB.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/phy_procedures_lte_common.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/sched_common_vars.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/phy_procedures_lte_eNb.c \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/sched_common_extern.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED/nfapi_nr_dummy.c \
@@ -2438,7 +2437,6 @@ INPUT                  = \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/MODULATION/nr_modulation.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/MODULATION/slot_fep.c \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/MODULATION/ul_7_5_kHz.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/MODULATION/modulation_vars.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/MODULATION/slot_fep_ul.c \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/phy_extern.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/defs_UE.h \
diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c
index 678f1e5e0c44f970088947e756ed2f52956e1b5e..be5416c7fde262334c96ecc19b3bbc738ff4bb3e 100644
--- a/executables/lte-softmodem.c
+++ b/executables/lte-softmodem.c
@@ -55,8 +55,6 @@
 #include <openair1/PHY/phy_extern_ue.h>
 
 #include "PHY/phy_vars.h"
-#include "SCHED/sched_common_vars.h"
-#include "LAYER2/MAC/mac_vars.h"
 
 #include "LAYER2/MAC/mac.h"
 #include "LAYER2/MAC/mac_proto.h"
@@ -107,6 +105,7 @@ uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
 
 
 int oai_exit = 0;
+int NB_UE_INST = 0;
 
 uint64_t                 downlink_frequency[MAX_NUM_CCs][4];
 int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
diff --git a/executables/lte-softmodem.h b/executables/lte-softmodem.h
index 97bc2d166bcb5de93b27280fe46fb67f8511a106..7f347bbee5280a5c0e8870451d176b9297d9541a 100644
--- a/executables/lte-softmodem.h
+++ b/executables/lte-softmodem.h
@@ -88,9 +88,9 @@
 /*                                            command line parameters specific to UE                                                                     */
 /*   optname                     helpstr             paramflags          XXXptr                          defXXXval            type          numelt       */
 /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
-
+// clang-format off
 #define CMDLINE_UEPARAMS_DESC {  \
-    {"U",                 CONFIG_HLP_NUMUE,       0,               u16ptr:&NB_UE_INST,                 defuintval:1,         TYPE_UINT16,   0},   \
+    {"U",                 CONFIG_HLP_NUMUE,       0,               iptr:&NB_UE_INST,                   defuintval:1,         TYPE_INT,      0},   \
     {"ue-rxgain",         CONFIG_HLP_UERXG,       0,               dblptr:&(rx_gain[0][0]),            defdblval:130,        TYPE_DOUBLE,   0},   \
     {"ue-rxgain-off",     CONFIG_HLP_UERXGOFF,    0,               dblptr:&rx_gain_off,                defdblval:0,          TYPE_DOUBLE,   0},   \
     {"ue-txgain",         CONFIG_HLP_UETXG,       0,               dblptr:&(tx_gain[0][0]),            defdblval:0,          TYPE_DOUBLE,   0},   \
@@ -100,8 +100,7 @@
     {"ue-max-power",      NULL,                   0,               iptr:&(tx_max_power[0]),            defintval:23,         TYPE_INT,      0},   \
     {"emul-iface",        CONFIG_HLP_EMULIFACE,   0,               strptr:&emul_iface,                 defstrval:"lo",       TYPE_STRING, 100},   \
     {"L2-emul",           NULL,                   0,               u8ptr:&nfapi_mode,                  defuintval:3,         TYPE_UINT8,    0},   \
-    {"num-ues",           NULL,                   0,               u16ptr:&(NB_UE_INST),               defuintval:1,         TYPE_UINT16,   0},   \
-    {"nums_ue_thread",    NULL,                   0,               u16ptr:&(NB_THREAD_INST),           defuintval:1,         TYPE_UINT16,   0},   \
+    {"num-ues",           NULL,                   0,               iptr:&(NB_UE_INST),                 defuintval:1,         TYPE_INT,      0},   \
     {"r"  ,               CONFIG_HLP_PRB,         0,               u8ptr:&(frame_parms[0]->N_RB_DL),   defintval:25,         TYPE_UINT8,    0},   \
     {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT,     0,               iptr:(int32_t *)&dlsch_demod_shift, defintval:0,          TYPE_INT,      0},   \
     {"usrp-args",         CONFIG_HLP_USRP_ARGS,   0,               strptr:&usrp_args,         defstrval:"type=b200",TYPE_STRING,   0},   \
@@ -111,6 +110,7 @@
     {"ue-idx-standalone", NULL,                   0,               u16ptr:&ue_idx_standalone,          defuintval:0xFFFF,    TYPE_UINT16,   0},   \
     {"node-number",       NULL,                   0,               u16ptr:&node_number,                defuintval:2,         TYPE_UINT16,   0},   \
   }
+// clang-format on
 
 /*-----------------------------------------------------------------------------------------------------------------------------*/
 /*                                            command line parameters specific to UE threads                                   */
diff --git a/executables/lte-ue.c b/executables/lte-ue.c
index 270e5b1d4e0c773e2eac2575ce143a9c8fe853dd..bc44820444f63195242202569c05c94c2b56e72f 100644
--- a/executables/lte-ue.c
+++ b/executables/lte-ue.c
@@ -69,7 +69,7 @@ extern double cpuf;
 #define FRAME_PERIOD    100000000ULL
 #define DAQ_PERIOD      66667ULL
 #define FIFO_PRIORITY   40
-
+#define NB_THREAD_INST 1
 typedef enum {
   pss=0,
   pbch=1,
diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c
index 16f8b0b2b9abe3f6d4b6cc247429c280f4384ccc..04358c7ec9fbed8756c6992450c3499670705797 100644
--- a/executables/lte-uesoftmodem.c
+++ b/executables/lte-uesoftmodem.c
@@ -54,11 +54,8 @@
 
 #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 "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"
@@ -102,7 +99,7 @@ uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
 int oai_exit = 0;
 
 unsigned int                    mmapped_dma=0;
-
+UE_MAC_INST *UE_mac_inst = NULL;
 
 uint64_t                 downlink_frequency[MAX_NUM_CCs][4];
 int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
@@ -518,14 +515,14 @@ AssertFatal(false,"");
 	return NULL;
 }
 
+int NB_UE_INST = 1;
+
 int main( int argc, char **argv ) {
 
   int CC_id;
   uint8_t  abstraction_flag=0;
   // Default value for the number of UEs. It will hold,
   // if not changed from the command line option --num-ues
-  NB_UE_INST=1;
-  NB_THREAD_INST=1;
   configmodule_interface_t *config_mod;
   start_background_system();
   config_mod = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
@@ -552,18 +549,6 @@ int main( int argc, char **argv ) {
   EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
   printf("Running with %d UE instances\n",NB_UE_INST);
 
-  // Checking option of nums_ue_thread.
-  if(NB_THREAD_INST < 1) {
-    printf("Running with 0 UE rxtx thread, exiting.\n");
-    abort();
-  }
-
-  // Checking option's relation between nums_ue_thread and num-ues
-  if(NB_UE_INST <NB_THREAD_INST ) {
-    printf("Number of UEs < number of UE rxtx threads, exiting.\n");
-    abort();
-  }
-
 #if T_TRACER
   T_Config_Init();
 #endif
@@ -606,8 +591,6 @@ int main( int argc, char **argv ) {
     frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
   }
 
-  NB_INST=1;
-
   if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
     PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE **)*NB_UE_INST);
 
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index 9f6c3574ec7197ab3a2a574a2618b02a6895dfab..8cd23b7159d8870093471480fc01fc868c300412 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -60,7 +60,6 @@ static int DEFENBS[] = {0};
 #include <openair2/UTIL/OPT/opt.h>
 #include <openair1/SIMULATION/TOOLS/sim.h>
 #include <openair1/PHY/phy_vars.h>
-#include <openair1/SCHED/sched_common_vars.h>
 #include <openair2/LAYER2/MAC/mac_vars.h>
 #include <openair2/RRC/LTE/rrc_vars.h>
 
diff --git a/executables/main_ru.c b/executables/main_ru.c
index 891b98b0908dfcc41816c57a4a12945b84abe0fb..9f9df6e84c9b39fc22f31de58b5d85d6d1532baa 100644
--- a/executables/main_ru.c
+++ b/executables/main_ru.c
@@ -48,9 +48,7 @@
 #include "radio/COMMON/common_lib.h"
 #include "radio/ETHERNET/USERSPACE/LIB/if_defs.h"
 
-
 #include "PHY/phy_vars.h"
-#include "SCHED/sched_common_vars.h"
 #include "PHY/TOOLS/phy_scope_interface.h"
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index cf603b74785a66b52efdbc3b7080efc8ad530cf6..0ecd46e5e0e7b94503e4c675bfe56e2a2d94c2e9 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -45,8 +45,6 @@
 //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
 
 #include "PHY/phy_vars.h"
-#include "SCHED/sched_common_vars.h"
-#include "LAYER2/MAC/mac_vars.h"
 #include "RRC/LTE/rrc_vars.h"
 #include "PHY_INTERFACE/phy_interface_vars.h"
 #include "gnb_config.h"
@@ -95,6 +93,8 @@ int config_sync_var=-1;
 volatile int             start_gNB = 0;
 int oai_exit = 0;
 
+int NB_UE_INST = 0;
+
 static int wait_for_sync = 0;
 
 unsigned int mmapped_dma=0;
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 0a9afc5f9a158f6faa490261d181682dbca19981..4aef4e56a342caceb75118a3c587e0fe42544626 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -42,12 +42,9 @@
 #include "openair1/PHY/MODULATION/nr_modulation.h"
 #include "PHY/phy_vars_nr_ue.h"
 #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
-#include "SCHED/sched_common_vars.h"
-#include "PHY/MODULATION/modulation_vars.h"
 #include "PHY/NR_TRANSPORT/nr_dlsch.h"
 //#include "../../SIMU/USER/init_lte.h"
 
-#include "LAYER2/MAC/mac_vars.h"
 #include "RRC/LTE/rrc_vars.h"
 #include "PHY_INTERFACE/phy_interface_vars.h"
 #include "NR_IF_Module.h"
@@ -403,6 +400,7 @@ static void get_channel_model_mode() {
     init_bler_table("NR_AWGN_RESULTS_DIR");
 }
 
+int NB_UE_INST = 1;
 
 int main( int argc, char **argv ) {
   int set_exe_prio = 1;
@@ -469,8 +467,6 @@ int main( int argc, char **argv ) {
     }
   }
 
-  NB_UE_INST=1;
-  NB_INST=1;
   PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **));
   PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs);
   if (get_softmodem_params()->emulate_l1) {
diff --git a/executables/rfsim.c b/executables/rfsim.c
index df604d247a39f6322264d104c46ef781d936d2bb..c7ab4ccb663cabb5754c163228ea0c5ce00c0110 100644
--- a/executables/rfsim.c
+++ b/executables/rfsim.c
@@ -45,7 +45,7 @@
 #include "openair1/SIMULATION/TOOLS/sim.h"
 #include "enb_config.h"
 #include "enb_paramdef.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "common/config/config_paramdesc.h"
 #include "common/config/config_userapi.h"
 #include "common/ran_context.h"
@@ -180,11 +180,12 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,1);
       do_UL_sig(&sim,
                 subframe,
-                0,  // abstraction_flag
+                0, // abstraction_flag
                 RC.ru[ru_id]->frame_parms,
-                0,  // frame is only used for abstraction
+                0, // frame is only used for abstraction
                 ru_id,
-                CC_id);
+                CC_id,
+                1);
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,0);
     }
 
diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c
index b4158dbb40f6bec8c49126e789c2be8e262103d1..a74c8daca62dec9ffa8e4de7e4527551b58c7ba2 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf.c
@@ -32,7 +32,7 @@
 
 # if 1 // for hard-code (remove later)
 #include "COMMON/platform_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "common/ran_context.h"
 
 #include "common/utils/LOG/log.h"
diff --git a/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h
index f77ffff2eb5bcf5fe01a0d712ddd8c21411234ec..be37f06b8d3f8ad5f4c8c23f221bb909bfb86df4 100644
--- a/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h
+++ b/openair1/PHY/CODING/TESTBENCH/coding_unitary_defs.h
@@ -22,7 +22,7 @@
 #ifndef __CODING_UNITARY_DEFS__h__
 #define __CODING_UNITARY_DEFS__h__
 int oai_exit=0;
-unsigned int NB_UE_INST = 1;
+const int NB_UE_INST = 1;
 #include "openair1/PHY/defs_UE.h"
 PHY_VARS_UE ***PHY_vars_UE_g;
 #include "common/ran_context.h"
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 81fb28cc98eda5baa21e057313d0fe0f55ff82e8..15b27b4db1dd18afd8bff61e862379b76889c6bb 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -26,7 +26,9 @@
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 #include "PHY/LTE_TRANSPORT/transport_common_proto.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
+int qam64_table[8], qam16_table[4], qpsk_table[2];
 void init_sss(void);
 
 void generate_64qam_table(void) {
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation_vars.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation_vars.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_ESTIMATION/lte_estimation_vars.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 380dce2c4fc9cf79e604df6ae7df1b54a397a083..152a298398704707245e6fdbce01f9a2e24ec305 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
@@ -26,6 +26,7 @@
 #include "common/utils/LOG/log.h"
 #include "PHY/LTE_TRANSPORT/transport_common_proto.h"
 #include "lte_estimation.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 // round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
 static int16_t ru_90[2*128] = {32767, 0,32766, 402,32758, 804,32746, 1206,32729, 1608,32706, 2009,32679, 2411,32647, 2811,32610, 3212,32568, 3612,32522, 4011,32470, 4410,32413, 4808,32352, 5205,32286, 5602,32214, 5998,32138, 6393,32058, 6787,31972, 7180,31881, 7571,31786, 7962,31686, 8351,31581, 8740,31471, 9127,31357, 9512,31238, 9896,31114, 10279,30986, 10660,30853, 11039,30715, 11417,30572, 11793,30425, 12167,30274, 12540,30118, 12910,29957, 13279,29792, 13646,29622, 14010,29448, 14373,29269, 14733,29086, 15091,28899, 15447,28707, 15800,28511, 16151,28311, 16500,28106, 16846,27897, 17190,27684, 17531,27467, 17869,27246, 18205,27020, 18538,26791, 18868,26557, 19195,26320, 19520,26078, 19841,25833, 20160,25583, 20475,25330, 20788,25073, 21097,24812, 21403,24548, 21706,24279, 22006,24008, 22302,23732, 22595,23453, 22884,23170, 23170,22884, 23453,22595, 23732,22302, 24008,22006, 24279,21706, 24548,21403, 24812,21097, 25073,20788, 25330,20475, 25583,20160, 25833,19841, 26078,19520, 26320,19195, 26557,18868, 26791,18538, 27020,18205, 27246,17869, 27467,17531, 27684,17190, 27897,16846, 28106,16500, 28311,16151, 28511,15800, 28707,15447, 28899,15091, 29086,14733, 29269,14373, 29448,14010, 29622,13646, 29792,13279, 29957,12910, 30118,12540, 30274,12167, 30425,11793, 30572,11417, 30715,11039, 30853,10660, 30986,10279, 31114,9896, 31238,9512, 31357,9127, 31471,8740, 31581,8351, 31686,7962, 31786,7571, 31881,7180, 31972,6787, 32058,6393, 32138,5998, 32214,5602, 32286,5205, 32352,4808, 32413,4410, 32470,4011, 32522,3612, 32568,3212, 32610,2811, 32647,2411, 32679,2009, 32706,1608, 32729,1206, 32746,804, 32758,402, 32766};
@@ -36,9 +37,6 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
 
 static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 
-extern unsigned short dftsizes[34];
-extern int16_t *ul_ref_sigs_rx[30][2][34];
-
 int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
                                   L1_rxtx_proc_t *proc,
 				  LTE_eNB_ULSCH_t * ulsch,
diff --git a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
index be090214f8475d28d6a81269c66860205856312d..4c80d7561e163d7bf4f16a5b0aef28cfcaf461f8 100644
--- a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
+++ b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c
@@ -26,11 +26,9 @@
 #endif
 #include "lte_refsig.h"
 #include "PHY/defs_eNB.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
-uint16_t dftsizes[34] = {12,24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,768,864,900,960,972,1080,1152,1200};
-
-uint16_t ref_primes[34] = {11,23,31,47,59,71,89,107,113,139,179,191,211,239,283,293,317,359,383,431,479,523,571,599,647,719,761,863,887,953,971,1069,1151,1193};
-
+const uint16_t ref_primes[34] = {11, 23, 31, 47, 59, 71, 89, 107, 113, 139, 179, 191, 211, 239, 283, 293, 317, 359, 383, 431, 479, 523, 571, 599, 647, 719, 761, 863, 887, 953, 971, 1069, 1151, 1193};
 
 int16_t *ul_ref_sigs[30][2][34];
 int16_t *ul_ref_sigs_rx[30][2][34]; //these contain the sequences in repeated format and quantized to QPSK ifdef IFFT_FPGA
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index 3f43a1cc42d1182110efe80c90cf02cf8563fc07..c3dffffd466d9302a93a3f311ef47fa79f890a01 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -43,7 +43,7 @@
 #include "T.h"
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
-#include "PHY/LTE_TRANSPORT/transport_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 #include "executables/lte-softmodem.h"
 //#define DEBUG_DCI_ENCODING 1
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
index 54803387284b1d31805b2a609b73a05a3791576e..3a18924fe4fe3b125a372f121110a3e3e4e8ac78 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
@@ -19,31 +19,31 @@
  *      contact@openairinterface.org
  */
 
-unsigned int dlsch_tbs25[27][25] = {{16,32,56,88,120,152,176,208,224,256,288,328,344,376,392,424,456,488,504,536,568,600,616,648,680},
-  {24,56,88,144,176,208,224,256,328,344,376,424,456,488,520,568,600,632,680,712,744,776,808,872,904},
-  {32,72,144,176,208,256,296,328,376,424,472,520,568,616,648,696,744,776,840,872,936,968,1000,1064,1096},
-  {40,104,176,208,256,328,392,440,504,568,616,680,744,808,872,904,968,1032,1096,1160,1224,1256,1320,1384,1416},
-  {56,120,208,256,328,408,488,552,632,696,776,840,904,1000,1064,1128,1192,1288,1352,1416,1480,1544,1608,1736,1800},
-  {72,144,224,328,424,504,600,680,776,872,968,1032,1128,1224,1320,1384,1480,1544,1672,1736,1864,1928,2024,2088,2216},
-  {328,176,256,392,504,600,712,808,936,1032,1128,1224,1352,1480,1544,1672,1736,1864,1992,2088,2216,2280,2408,2472,2600},
-  {104,224,328,472,584,712,840,968,1096,1224,1320,1480,1608,1672,1800,1928,2088,2216,2344,2472,2536,2664,2792,2984,3112},
-  {120,256,392,536,680,808,968,1096,1256,1384,1544,1672,1800,1928,2088,2216,2344,2536,2664,2792,2984,3112,3240,3368,3496},
-  {136,296,456,616,776,936,1096,1256,1416,1544,1736,1864,2024,2216,2344,2536,2664,2856,2984,3112,3368,3496,3624,3752,4008},
-  {144,328,504,680,872,1032,1224,1384,1544,1736,1928,2088,2280,2472,2664,2792,2984,3112,3368,3496,3752,3880,4008,4264,4392},
-  {176,376,584,776,1000,1192,1384,1608,1800,2024,2216,2408,2600,2792,2984,3240,3496,3624,3880,4008,4264,4392,4584,4776,4968},
-  {208,440,680,904,1128,1352,1608,1800,2024,2280,2472,2728,2984,3240,3368,3624,3880,4136,4392,4584,4776,4968,5352,5544,5736},
-  {224,488,744,1000,1256,1544,1800,2024,2280,2536,2856,3112,3368,3624,3880,4136,4392,4584,4968,5160,5352,5736,5992,6200,6456},
-  {256,552,840,1128,1416,1736,1992,2280,2600,2856,3112,3496,3752,4008,4264,4584,4968,5160,5544,5736,5992,6200,6456,6968,7224},
-  {280,600,904,1224,1544,1800,2152,2472,2728,3112,3368,3624,4008,4264,4584,4968,5160,5544,5736,6200,6456,6712,6968,7224,7736},
-  {328,632,968,1288,1608,1928,2280,2600,2984,3240,3624,3880,4264,4584,4968,5160,5544,5992,6200,6456,6712,7224,7480,7736,7992},
-  {336,696,1064,1416,1800,2152,2536,2856,3240,3624,4008,4392,4776,5160,5352,5736,6200,6456,6712,7224,7480,7992,8248,8760,9144},
-  {376,776,1160,1544,1992,2344,2792,3112,3624,4008,4392,4776,5160,5544,5992,6200,6712,7224,7480,7992,8248,8760,9144,9528,9912},
-  {408,840,1288,1736,2152,2600,2984,3496,3880,4264,4776,5160,5544,5992,6456,6968,7224,7736,8248,8504,9144,9528,9912,10296,10680},
-  {440,904,1384,1864,2344,2792,3240,3752,4136,4584,5160,5544,5992,6456,6968,7480,7992,8248,8760,9144,9912,10296,10680,11064,11448},
-  {488,1000,1480,1992,2472,2984,3496,4008,4584,4968,5544,5992,6456,6968,7480,7992,8504,9144,9528,9912,10680,11064,11448,12216,12576},
-  {520,1064,1608,2152,2664,3240,3752,4264,4776,5352,5992,6456,6968,7480,7992,8504,9144,9528,10296,10680,11448,11832,12576,12960,13536},
-  {552,1128,1736,2280,2856,3496,4008,4584,5160,5736,6200,6968,7480,7992,8504,9144,9912,10296,11064,11448,12216,12576,12960,13536,14112},
-  {584,1192,1800,2408,2984,3624,4264,4968,5544,5992,6712,7224,7992,8504,9144,9912,10296,11064,11448,12216,12960,13536,14112,14688,15264},
-  {616,1256,1864,2536,3112,3752,4392,5160,5736,6200,6968,7480,8248,8760,9528,10296,10680,11448,12216,12576,13536,14112,14688,15264,15840},
-  {712,1480,2216,2984,3752,4392,5160,5992,6712,7480,8248,8760,9528,10296,11064,11832,12576,13536,14112,14688,15264,16416,16992,17568,18336}
-};
+static const unsigned int dlsch_tbs25[27][25] = {
+    {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680},
+    {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904},
+    {32, 72, 144, 176, 208, 256, 296, 328, 376, 424, 472, 520, 568, 616, 648, 696, 744, 776, 840, 872, 936, 968, 1000, 1064, 1096},
+    {40, 104, 176, 208, 256, 328, 392, 440, 504, 568, 616, 680, 744, 808, 872, 904, 968, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416},
+    {56, 120, 208, 256, 328, 408, 488, 552, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1288, 1352, 1416, 1480, 1544, 1608, 1736, 1800},
+    {72, 144, 224, 328, 424, 504, 600, 680, 776, 872, 968, 1032, 1128, 1224, 1320, 1384, 1480, 1544, 1672, 1736, 1864, 1928, 2024, 2088, 2216},
+    {328, 176, 256, 392, 504, 600, 712, 808, 936, 1032, 1128, 1224, 1352, 1480, 1544, 1672, 1736, 1864, 1992, 2088, 2216, 2280, 2408, 2472, 2600},
+    {104, 224, 328, 472, 584, 712, 840, 968, 1096, 1224, 1320, 1480, 1608, 1672, 1800, 1928, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2984, 3112},
+    {120, 256, 392, 536, 680, 808, 968, 1096, 1256, 1384, 1544, 1672, 1800, 1928, 2088, 2216, 2344, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3496},
+    {136, 296, 456, 616, 776, 936, 1096, 1256, 1416, 1544, 1736, 1864, 2024, 2216, 2344, 2536, 2664, 2856, 2984, 3112, 3368, 3496, 3624, 3752, 4008},
+    {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392},
+    {176, 376, 584, 776, 1000, 1192, 1384, 1608, 1800, 2024, 2216, 2408, 2600, 2792, 2984, 3240, 3496, 3624, 3880, 4008, 4264, 4392, 4584, 4776, 4968},
+    {208, 440, 680, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2472, 2728, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4776, 4968, 5352, 5544, 5736},
+    {224, 488, 744, 1000, 1256, 1544, 1800, 2024, 2280, 2536, 2856, 3112, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456},
+    {256, 552, 840, 1128, 1416, 1736, 1992, 2280, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 5992, 6200, 6456, 6968, 7224},
+    {280, 600, 904, 1224, 1544, 1800, 2152, 2472, 2728, 3112, 3368, 3624, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 6200, 6456, 6712, 6968, 7224, 7736},
+    {328, 632, 968, 1288, 1608, 1928, 2280, 2600, 2984, 3240, 3624, 3880, 4264, 4584, 4968, 5160, 5544, 5992, 6200, 6456, 6712, 7224, 7480, 7736, 7992},
+    {336, 696, 1064, 1416, 1800, 2152, 2536, 2856, 3240, 3624, 4008, 4392, 4776, 5160, 5352, 5736, 6200, 6456, 6712, 7224, 7480, 7992, 8248, 8760, 9144},
+    {376, 776, 1160, 1544, 1992, 2344, 2792, 3112, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912},
+    {408, 840, 1288, 1736, 2152, 2600, 2984, 3496, 3880, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7736, 8248, 8504, 9144, 9528, 9912, 10296, 10680},
+    {440, 904, 1384, 1864, 2344, 2792, 3240, 3752, 4136, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 8760, 9144, 9912, 10296, 10680, 11064, 11448},
+    {488, 1000, 1480, 1992, 2472, 2984, 3496, 4008, 4584, 4968, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 9912, 10680, 11064, 11448, 12216, 12576},
+    {520, 1064, 1608, 2152, 2664, 3240, 3752, 4264, 4776, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 10296, 10680, 11448, 11832, 12576, 12960, 13536},
+    {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112},
+    {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264},
+    {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840},
+    {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336}};
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
index 5a08b7a40238256aef630e97749ad8f7d283b05c..3947ffc31d1d44fe72d1870ff046e148b28b3de9 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h
@@ -27,34 +27,116 @@
 /** \brief "Transport block size table"
  *  (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0)
  */
-unsigned int TBStable[TBStable_rowCnt][110] = {{16,32,56,88,120,152,176,208,224,256,288,328,344,376,392,424,456,488,504,536,568,600,616,648,680,712,744,776,776,808,840,872,904,936,968,1000,1032,1032,1064,1096,1128,1160,1192,1224,1256,1256,1288,1320,1352,1384,1416,1416,1480,1480,1544,1544,1608,1608,1608,1672,1672,1736,1736,1800,1800,1800,1864,1864,1928,1928,1992,1992,2024,2088,2088,2088,2152,2152,2216,2216,2280,2280,2280,2344,2344,2408,2408,2472,2472,2536,2536,2536,2600,2600,2664,2664,2728,2728,2728,2792,2792,2856,2856,2856,2984,2984,2984,2984,2984,3112},
-  {24,56,88,144,176,208,224,256,328,344,376,424,456,488,520,568,600,632,680,712,744,776,808,872,904,936,968,1000,1032,1064,1128,1160,1192,1224,1256,1288,1352,1384,1416,1416,1480,1544,1544,1608,1608,1672,1736,1736,1800,1800,1864,1864,1928,1992,1992,2024,2088,2088,2152,2152,2216,2280,2280,2344,2344,2408,2472,2472,2536,2536,2600,2600,2664,2728,2728,2792,2792,2856,2856,2856,2984,2984,2984,3112,3112,3112,3240,3240,3240,3240,3368,3368,3368,3496,3496,3496,3496,3624,3624,3624,3752,3752,3752,3752,3880,3880,3880,4008,4008,4008},
-  {32,72,144,176,208,256,296,328,376,424,472,520,568,616,648,696,744,776,840,872,936,968,1000,1064,1096,1160,1192,1256,1288,1320,1384,1416,1480,1544,1544,1608,1672,1672,1736,1800,1800,1864,1928,1992,2024,2088,2088,2152,2216,2216,2280,2344,2344,2408,2472,2536,2536,2600,2664,2664,2728,2792,2856,2856,2856,2984,2984,3112,3112,3112,3240,3240,3240,3368,3368,3368,3496,3496,3496,3624,3624,3624,3752,3752,3880,3880,3880,4008,4008,4008,4136,4136,4136,4264,4264,4264,4392,4392,4392,4584,4584,4584,4584,4584,4776,4776,4776,4776,4968,4968},
-  {40,104,176,208,256,328,392,440,504,568,616,680,744,808,872,904,968,1032,1096,1160,1224,1256,1320,1384,1416,1480,1544,1608,1672,1736,1800,1864,1928,1992,2024,2088,2152,2216,2280,2344,2408,2472,2536,2536,2600,2664,2728,2792,2856,2856,2984,2984,3112,3112,3240,3240,3368,3368,3496,3496,3624,3624,3624,3752,3752,3880,3880,4008,4008,4136,4136,4264,4264,4392,4392,4392,4584,4584,4584,4776,4776,4776,4776,4968,4968,4968,5160,5160,5160,5352,5352,5352,5352,5544,5544,5544,5736,5736,5736,5736,5992,5992,5992,5992,6200,6200,6200,6200,6456,6456},
-  {56,120,208,256,328,408,488,552,632,696,776,840,904,1000,1064,1128,1192,1288,1352,1416,1480,1544,1608,1736,1800,1864,1928,1992,2088,2152,2216,2280,2344,2408,2472,2600,2664,2728,2792,2856,2984,2984,3112,3112,3240,3240,3368,3496,3496,3624,3624,3752,3752,3880,4008,4008,4136,4136,4264,4264,4392,4392,4584,4584,4584,4776,4776,4968,4968,4968,5160,5160,5160,5352,5352,5544,5544,5544,5736,5736,5736,5992,5992,5992,5992,6200,6200,6200,6456,6456,6456,6456,6712,6712,6712,6968,6968,6968,6968,7224,7224,7224,7480,7480,7480,7480,7736,7736,7736,7992},
-  {72,144,224,328,424,504,600,680,776,872,968,1032,1128,1224,1320,1384,1480,1544,1672,1736,1864,1928,2024,2088,2216,2280,2344,2472,2536,2664,2728,2792,2856,2984,3112,3112,3240,3368,3496,3496,3624,3752,3752,3880,4008,4008,4136,4264,4392,4392,4584,4584,4776,4776,4776,4968,4968,5160,5160,5352,5352,5544,5544,5736,5736,5736,5992,5992,5992,6200,6200,6200,6456,6456,6712,6712,6712,6968,6968,6968,7224,7224,7224,7480,7480,7480,7736,7736,7736,7992,7992,7992,8248,8248,8248,8504,8504,8760,8760,8760,8760,9144,9144,9144,9144,9528,9528,9528,9528,9528},
-  {328,176,256,392,504,600,712,808,936,1032,1128,1224,1352,1480,1544,1672,1736,1864,1992,2088,2216,2280,2408,2472,2600,2728,2792,2984,2984,3112,3240,3368,3496,3496,3624,3752,3880,4008,4136,4136,4264,4392,4584,4584,4776,4776,4968,4968,5160,5160,5352,5352,5544,5736,5736,5992,5992,5992,6200,6200,6456,6456,6456,6712,6712,6968,6968,6968,7224,7224,7480,7480,7736,7736,7736,7992,7992,8248,8248,8248,8504,8504,8760,8760,8760,9144,9144,9144,9144,9528,9528,9528,9528,9912,9912,9912,10296,10296,10296,10296,10680,10680,10680,10680,11064,11064,11064,11448,11448,11448},
-  {104,224,328,472,584,712,840,968,1096,1224,1320,1480,1608,1672,1800,1928,2088,2216,2344,2472,2536,2664,2792,2984,3112,3240,3368,3368,3496,3624,3752,3880,4008,4136,4264,4392,4584,4584,4776,4968,4968,5160,5352,5352,5544,5736,5736,5992,5992,6200,6200,6456,6456,6712,6712,6712,6968,6968,7224,7224,7480,7480,7736,7736,7992,7992,8248,8248,8504,8504,8760,8760,8760,9144,9144,9144,9528,9528,9528,9912,9912,9912,10296,10296,10296,10680,10680,10680,11064,11064,11064,11448,11448,11448,11448,11832,11832,11832,12216,12216,12216,12576,12576,12576,12960,12960,12960,12960,13536,13536},
-  {120,256,392,536,680,808,968,1096,1256,1384,1544,1672,1800,1928,2088,2216,2344,2536,2664,2792,2984,3112,3240,3368,3496,3624,3752,3880,4008,4264,4392,4584,4584,4776,4968,4968,5160,5352,5544,5544,5736,5992,5992,6200,6200,6456,6456,6712,6968,6968,7224,7224,7480,7480,7736,7736,7992,7992,8248,8504,8504,8760,8760,9144,9144,9144,9528,9528,9528,9912,9912,9912,10296,10296,10680,10680,10680,11064,11064,11064,11448,11448,11448,11832,11832,12216,12216,12216,12576,12576,12576,12960,12960,12960,13536,13536,13536,13536,14112,14112,14112,14112,14688,14688,14688,14688,15264,15264,15264,15264},
-  {136,296,456,616,776,936,1096,1256,1416,1544,1736,1864,2024,2216,2344,2536,2664,2856,2984,3112,3368,3496,3624,3752,4008,4136,4264,4392,4584,4776,4968,5160,5160,5352,5544,5736,5736,5992,6200,6200,6456,6712,6712,6968,6968,7224,7480,7480,7736,7992,7992,8248,8248,8504,8760,8760,9144,9144,9144,9528,9528,9912,9912,10296,10296,10296,10680,10680,11064,11064,11064,11448,11448,11832,11832,11832,12216,12216,12576,12576,12960,12960,12960,13536,13536,13536,13536,14112,14112,14112,14112,14688,14688,14688,15264,15264,15264,15264,15840,15840,15840,16416,16416,16416,16416,16992,16992,16992,16992,17568},
-  {144,328,504,680,872,1032,1224,1384,1544,1736,1928,2088,2280,2472,2664,2792,2984,3112,3368,3496,3752,3880,4008,4264,4392,4584,4776,4968,5160,5352,5544,5736,5736,5992,6200,6200,6456,6712,6712,6968,7224,7480,7480,7736,7992,7992,8248,8504,8504,8760,9144,9144,9144,9528,9528,9912,9912,10296,10296,10680,10680,11064,11064,11448,11448,11448,11832,11832,12216,12216,12576,12576,12960,12960,12960,13536,13536,13536,14112,14112,14112,14688,14688,14688,14688,15264,15264,15264,15840,15840,15840,16416,16416,16416,16992,16992,16992,16992,17568,17568,17568,18336,18336,18336,18336,18336,19080,19080,19080,19080},
-  {176,376,584,776,1000,1192,1384,1608,1800,2024,2216,2408,2600,2792,2984,3240,3496,3624,3880,4008,4264,4392,4584,4776,4968,5352,5544,5736,5992,5992,6200,6456,6712,6968,6968,7224,7480,7736,7736,7992,8248,8504,8760,8760,9144,9144,9528,9528,9912,9912,10296,10680,10680,11064,11064,11448,11448,11832,11832,12216,12216,12576,12576,12960,12960,13536,13536,13536,14112,14112,14112,14688,14688,14688,15264,15264,15840,15840,15840,16416,16416,16416,16992,16992,16992,17568,17568,17568,18336,18336,18336,18336,19080,19080,19080,19080,19848,19848,19848,19848,20616,20616,20616,21384,21384,21384,21384,22152,22152,22152},
-  {208,440,680,904,1128,1352,1608,1800,2024,2280,2472,2728,2984,3240,3368,3624,3880,4136,4392,4584,4776,4968,5352,5544,5736,5992,6200,6456,6712,6712,6968,7224,7480,7736,7992,8248,8504,8760,8760,9144,9528,9528,9912,9912,10296,10680,10680,11064,11064,11448,11832,11832,12216,12216,12576,12576,12960,12960,13536,13536,14112,14112,14112,14688,14688,15264,15264,15264,15840,15840,16416,16416,16416,16992,16992,17568,17568,17568,18336,18336,18336,19080,19080,19080,19080,19848,19848,19848,20616,20616,20616,21384,21384,21384,21384,22152,22152,22152,22920,22920,22920,23688,23688,23688,23688,24496,24496,24496,24496,25456},
-  {224,488,744,1000,1256,1544,1800,2024,2280,2536,2856,3112,3368,3624,3880,4136,4392,4584,4968,5160,5352,5736,5992,6200,6456,6712,6968,7224,7480,7736,7992,8248,8504,8760,9144,9144,9528,9912,9912,10296,10680,10680,11064,11448,11448,11832,12216,12216,12576,12960,12960,13536,13536,14112,14112,14688,14688,14688,15264,15264,15840,15840,16416,16416,16992,16992,16992,17568,17568,18336,18336,18336,19080,19080,19080,19848,19848,19848,20616,20616,20616,21384,21384,21384,22152,22152,22152,22920,22920,22920,23688,23688,23688,24496,24496,24496,25456,25456,25456,25456,26416,26416,26416,26416,27376,27376,27376,27376,28336,28336},
-  {256,552,840,1128,1416,1736,1992,2280,2600,2856,3112,3496,3752,4008,4264,4584,4968,5160,5544,5736,5992,6200,6456,6968,7224,7480,7736,7992,8248,8504,8760,9144,9528,9912,9912,10296,10680,11064,11064,11448,11832,12216,12216,12576,12960,12960,13536,13536,14112,14112,14688,14688,15264,15264,15840,15840,16416,16416,16992,16992,17568,17568,18336,18336,18336,19080,19080,19848,19848,19848,20616,20616,20616,21384,21384,22152,22152,22152,22920,22920,22920,23688,23688,24496,24496,24496,25456,25456,25456,25456,26416,26416,26416,27376,27376,27376,28336,28336,28336,28336,29296,29296,29296,29296,30576,30576,30576,30576,31704,31704},
-  {280,600,904,1224,1544,1800,2152,2472,2728,3112,3368,3624,4008,4264,4584,4968,5160,5544,5736,6200,6456,6712,6968,7224,7736,7992,8248,8504,8760,9144,9528,9912,10296,10296,10680,11064,11448,11832,11832,12216,12576,12960,12960,13536,13536,14112,14688,14688,15264,15264,15840,15840,16416,16416,16992,16992,17568,17568,18336,18336,18336,19080,19080,19848,19848,20616,20616,20616,21384,21384,22152,22152,22152,22920,22920,23688,23688,23688,24496,24496,24496,25456,25456,25456,26416,26416,26416,27376,27376,27376,28336,28336,28336,29296,29296,29296,29296,30576,30576,30576,30576,31704,31704,31704,31704,32856,32856,32856,34008,34008},
-  {328,632,968,1288,1608,1928,2280,2600,2984,3240,3624,3880,4264,4584,4968,5160,5544,5992,6200,6456,6712,7224,7480,7736,7992,8504,8760,9144,9528,9912,9912,10296,10680,11064,11448,11832,12216,12216,12576,12960,13536,13536,14112,14112,14688,14688,15264,15840,15840,16416,16416,16992,16992,17568,17568,18336,18336,19080,19080,19848,19848,19848,20616,20616,21384,21384,22152,22152,22152,22920,22920,23688,23688,24496,24496,24496,25456,25456,25456,26416,26416,26416,27376,27376,27376,28336,28336,28336,29296,29296,29296,30576,30576,30576,30576,31704,31704,31704,31704,32856,32856,32856,34008,34008,34008,34008,35160,35160,35160,35160},
-  {336,696,1064,1416,1800,2152,2536,2856,3240,3624,4008,4392,4776,5160,5352,5736,6200,6456,6712,7224,7480,7992,8248,8760,9144,9528,9912,10296,10296,10680,11064,11448,11832,12216,12576,12960,13536,13536,14112,14688,14688,15264,15264,15840,16416,16416,16992,17568,17568,18336,18336,19080,19080,19848,19848,20616,20616,20616,21384,21384,22152,22152,22920,22920,23688,23688,24496,24496,24496,25456,25456,26416,26416,26416,27376,27376,27376,28336,28336,29296,29296,29296,30576,30576,30576,30576,31704,31704,31704,32856,32856,32856,34008,34008,34008,35160,35160,35160,35160,36696,36696,36696,36696,37888,37888,37888,39232,39232,39232,39232},
-  {376,776,1160,1544,1992,2344,2792,3112,3624,4008,4392,4776,5160,5544,5992,6200,6712,7224,7480,7992,8248,8760,9144,9528,9912,10296,10680,11064,11448,11832,12216,12576,12960,13536,14112,14112,14688,15264,15264,15840,16416,16416,16992,17568,17568,18336,18336,19080,19080,19848,19848,20616,21384,21384,22152,22152,22920,22920,23688,23688,24496,24496,24496,25456,25456,26416,26416,27376,27376,27376,28336,28336,29296,29296,29296,30576,30576,30576,31704,31704,31704,32856,32856,32856,34008,34008,34008,35160,35160,35160,36696,36696,36696,37888,37888,37888,37888,39232,39232,39232,40576,40576,40576,40576,42368,42368,42368,42368,43816,43816},
-  {408,840,1288,1736,2152,2600,2984,3496,3880,4264,4776,5160,5544,5992,6456,6968,7224,7736,8248,8504,9144,9528,9912,10296,10680,11064,11448,12216,12576,12960,13536,13536,14112,14688,15264,15264,15840,16416,16992,16992,17568,18336,18336,19080,19080,19848,20616,20616,21384,21384,22152,22152,22920,22920,23688,24496,24496,25456,25456,25456,26416,26416,27376,27376,28336,28336,29296,29296,29296,30576,30576,30576,31704,31704,32856,32856,32856,34008,34008,34008,35160,35160,35160,36696,36696,36696,37888,37888,37888,39232,39232,39232,40576,40576,40576,40576,42368,42368,42368,43816,43816,43816,43816,45352,45352,45352,46888,46888,46888,46888},
-  {440,904,1384,1864,2344,2792,3240,3752,4136,4584,5160,5544,5992,6456,6968,7480,7992,8248,8760,9144,9912,10296,10680,11064,11448,12216,12576,12960,13536,14112,14688,14688,15264,15840,16416,16992,16992,17568,18336,18336,19080,19848,19848,20616,20616,21384,22152,22152,22920,22920,23688,24496,24496,25456,25456,26416,26416,27376,27376,28336,28336,29296,29296,29296,30576,30576,31704,31704,31704,32856,32856,34008,34008,34008,35160,35160,35160,36696,36696,36696,37888,37888,39232,39232,39232,40576,40576,40576,42368,42368,42368,42368,43816,43816,43816,45352,45352,45352,46888,46888,46888,46888,48936,48936,48936,48936,48936,51024,51024,51024},
-  {488,1000,1480,1992,2472,2984,3496,4008,4584,4968,5544,5992,6456,6968,7480,7992,8504,9144,9528,9912,10680,11064,11448,12216,12576,12960,13536,14112,14688,15264,15840,15840,16416,16992,17568,18336,18336,19080,19848,19848,20616,21384,21384,22152,22920,22920,23688,24496,24496,25456,25456,26416,26416,27376,27376,28336,28336,29296,29296,30576,30576,31704,31704,31704,32856,32856,34008,34008,35160,35160,35160,36696,36696,36696,37888,37888,39232,39232,39232,40576,40576,40576,42368,42368,42368,43816,43816,43816,45352,45352,45352,46888,46888,46888,46888,48936,48936,48936,48936,51024,51024,51024,51024,52752,52752,52752,52752,55056,55056,55056},
-  {520,1064,1608,2152,2664,3240,3752,4264,4776,5352,5992,6456,6968,7480,7992,8504,9144,9528,10296,10680,11448,11832,12576,12960,13536,14112,14688,15264,15840,16416,16992,16992,17568,18336,19080,19080,19848,20616,21384,21384,22152,22920,22920,23688,24496,24496,25456,25456,26416,27376,27376,28336,28336,29296,29296,30576,30576,31704,31704,32856,32856,34008,34008,34008,35160,35160,36696,36696,36696,37888,37888,39232,39232,40576,40576,40576,42368,42368,42368,43816,43816,43816,45352,45352,45352,46888,46888,46888,48936,48936,48936,48936,51024,51024,51024,51024,52752,52752,52752,55056,55056,55056,55056,57336,57336,57336,57336,59256,59256,59256},
-  {552,1128,1736,2280,2856,3496,4008,4584,5160,5736,6200,6968,7480,7992,8504,9144,9912,10296,11064,11448,12216,12576,12960,13536,14112,14688,15264,15840,16416,16992,17568,18336,19080,19848,19848,20616,21384,22152,22152,22920,23688,24496,24496,25456,25456,26416,27376,27376,28336,28336,29296,29296,30576,30576,31704,31704,32856,32856,34008,34008,35160,35160,36696,36696,37888,37888,37888,39232,39232,40576,40576,40576,42368,42368,43816,43816,43816,45352,45352,45352,46888,46888,46888,48936,48936,48936,51024,51024,51024,51024,52752,52752,52752,55056,55056,55056,55056,57336,57336,57336,57336,59256,59256,59256,59256,61664,61664,61664,61664,63776},
-  {584,1192,1800,2408,2984,3624,4264,4968,5544,5992,6712,7224,7992,8504,9144,9912,10296,11064,11448,12216,12960,13536,14112,14688,15264,15840,16416,16992,17568,18336,19080,19848,19848,20616,21384,22152,22920,22920,23688,24496,25456,25456,26416,26416,27376,28336,28336,29296,29296,30576,31704,31704,32856,32856,34008,34008,35160,35160,36696,36696,36696,37888,37888,39232,39232,40576,40576,42368,42368,42368,43816,43816,45352,45352,45352,46888,46888,46888,48936,48936,48936,51024,51024,51024,52752,52752,52752,52752,55056,55056,55056,57336,57336,57336,57336,59256,59256,59256,61664,61664,61664,61664,63776,63776,63776,63776,66592,66592,66592,66592},
-  {616,1256,1864,2536,3112,3752,4392,5160,5736,6200,6968,7480,8248,8760,9528,10296,10680,11448,12216,12576,13536,14112,14688,15264,15840,16416,16992,17568,18336,19080,19848,20616,20616,21384,22152,22920,23688,24496,24496,25456,26416,26416,27376,28336,28336,29296,29296,30576,31704,31704,32856,32856,34008,34008,35160,35160,36696,36696,37888,37888,39232,39232,40576,40576,40576,42368,42368,43816,43816,43816,45352,45352,46888,46888,46888,48936,48936,48936,51024,51024,51024,52752,52752,52752,55056,55056,55056,55056,57336,57336,57336,59256,59256,59256,61664,61664,61664,61664,63776,63776,63776,63776,66592,66592,66592,66592,68808,68808,68808,71112},
-  {712,1480,2216,2984,3752,4392,5160,5992,6712,7480,8248,8760,9528,10296,11064,11832,12576,13536,14112,14688,15264,16416,16992,17568,18336,19080,19848,20616,21384,22152,22920,23688,24496,25456,25456,26416,27376,28336,29296,29296,30576,30576,31704,32856,32856,34008,35160,35160,36696,36696,37888,37888,39232,40576,40576,40576,42368,42368,43816,43816,45352,45352,46888,46888,48936,48936,48936,51024,51024,52752,52752,52752,55056,55056,55056,55056,57336,57336,57336,59256,59256,59256,61664,61664,61664,63776,63776,63776,66592,66592,66592,68808,68808,68808,71112,71112,71112,73712,73712,75376,75376,75376,75376,75376,75376,75376,75376,75376,75376,75376}
-};
+static const unsigned int TBStable[TBStable_rowCnt][110] = {
+    {16,   32,   56,   88,   120,  152,  176,  208,  224,  256,  288,  328,  344,  376,  392,  424,  456,  488,  504,  536,  568,  600,  616,  648,  680,  712,  744,  776,
+     776,  808,  840,  872,  904,  936,  968,  1000, 1032, 1032, 1064, 1096, 1128, 1160, 1192, 1224, 1256, 1256, 1288, 1320, 1352, 1384, 1416, 1416, 1480, 1480, 1544, 1544,
+     1608, 1608, 1608, 1672, 1672, 1736, 1736, 1800, 1800, 1800, 1864, 1864, 1928, 1928, 1992, 1992, 2024, 2088, 2088, 2088, 2152, 2152, 2216, 2216, 2280, 2280, 2280, 2344,
+     2344, 2408, 2408, 2472, 2472, 2536, 2536, 2536, 2600, 2600, 2664, 2664, 2728, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 2984, 2984, 3112},
+    {24,   56,   88,   144,  176,  208,  224,  256,  328,  344,  376,  424,  456,  488,  520,  568,  600,  632,  680,  712,  744,  776,  808,  872,  904,  936,  968,  1000,
+     1032, 1064, 1128, 1160, 1192, 1224, 1256, 1288, 1352, 1384, 1416, 1416, 1480, 1544, 1544, 1608, 1608, 1672, 1736, 1736, 1800, 1800, 1864, 1864, 1928, 1992, 1992, 2024,
+     2088, 2088, 2152, 2152, 2216, 2280, 2280, 2344, 2344, 2408, 2472, 2472, 2536, 2536, 2600, 2600, 2664, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 3112,
+     3112, 3112, 3240, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008},
+    {32,   72,   144,  176,  208,  256,  296,  328,  376,  424,  472,  520,  568,  616,  648,  696,  744,  776,  840,  872,  936,  968,  1000, 1064, 1096, 1160, 1192, 1256,
+     1288, 1320, 1384, 1416, 1480, 1544, 1544, 1608, 1672, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2024, 2088, 2088, 2152, 2216, 2216, 2280, 2344, 2344, 2408, 2472, 2536,
+     2536, 2600, 2664, 2664, 2728, 2792, 2856, 2856, 2856, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752,
+     3880, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968},
+    {40,   104,  176,  208,  256,  328,  392,  440,  504,  568,  616,  680,  744,  808,  872,  904,  968,  1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608,
+     1672, 1736, 1800, 1864, 1928, 1992, 2024, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240,
+     3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968,
+     4968, 4968, 5160, 5160, 5160, 5352, 5352, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6200, 6456, 6456},
+    {56,   120,  208,  256,  328,  408,  488,  552,  632,  696,  776,  840,  904,  1000, 1064, 1128, 1192, 1288, 1352, 1416, 1480, 1544, 1608, 1736, 1800, 1864, 1928, 1992,
+     2088, 2152, 2216, 2280, 2344, 2408, 2472, 2600, 2664, 2728, 2792, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008,
+     4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992,
+     5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992},
+    {72,   144,  224,  328,  424,  504,  600,  680,  776,  872,  968,  1032, 1128, 1224, 1320, 1384, 1480, 1544, 1672, 1736, 1864, 1928, 2024, 2088, 2216, 2280, 2344, 2472,
+     2536, 2664, 2728, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4264, 4392, 4392, 4584, 4584, 4776, 4776, 4776, 4968,
+     4968, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480,
+     7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9528},
+    {328,  176,  256,  392,  504,  600,  712,  808,  936,  1032, 1128, 1224, 1352,  1480,  1544,  1672,  1736,  1864,  1992,  2088,  2216,  2280,  2408,  2472,  2600,  2728, 2792, 2984,
+     2984, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3880, 4008, 4136, 4136, 4264,  4392,  4584,  4584,  4776,  4776,  4968,  4968,  5160,  5160,  5352,  5352,  5544,  5736, 5736, 5992,
+     5992, 5992, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6968, 6968, 6968, 7224,  7224,  7480,  7480,  7736,  7736,  7736,  7992,  7992,  8248,  8248,  8248,  8504,  8504, 8760, 8760,
+     8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448},
+    {104,   224,   328,   472,   584,   712,   840,   968,   1096,  1224,  1320,  1480,  1608,  1672,  1800,  1928,  2088,  2216,  2344,  2472,  2536,  2664,  2792,  2984,  3112,  3240, 3368,  3368,
+     3496,  3624,  3752,  3880,  4008,  4136,  4264,  4392,  4584,  4584,  4776,  4968,  4968,  5160,  5352,  5352,  5544,  5736,  5736,  5992,  5992,  6200,  6200,  6456,  6456,  6712, 6712,  6712,
+     6968,  6968,  7224,  7224,  7480,  7480,  7736,  7736,  7992,  7992,  8248,  8248,  8504,  8504,  8760,  8760,  8760,  9144,  9144,  9144,  9528,  9528,  9528,  9912,  9912,  9912, 10296, 10296,
+     10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536},
+    {120,   256,   392,   536,   680,   808,   968,   1096,  1256,  1384,  1544,  1672,  1800,  1928,  2088,  2216,  2344,  2536,  2664,  2792,  2984,  3112,  3240,  3368,  3496,  3624,  3752,  3880,
+     4008,  4264,  4392,  4584,  4584,  4776,  4968,  4968,  5160,  5352,  5544,  5544,  5736,  5992,  5992,  6200,  6200,  6456,  6456,  6712,  6968,  6968,  7224,  7224,  7480,  7480,  7736,  7736,
+     7992,  7992,  8248,  8504,  8504,  8760,  8760,  9144,  9144,  9144,  9528,  9528,  9528,  9912,  9912,  9912,  10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832,
+     11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15264},
+    {136,   296,   456,   616,   776,   936,   1096,  1256,  1416,  1544,  1736,  1864,  2024,  2216,  2344,  2536,  2664,  2856,  2984,  3112,  3368,  3496,  3624,  3752,  4008,  4136,  4264,  4392,
+     4584,  4776,  4968,  5160,  5160,  5352,  5544,  5736,  5736,  5992,  6200,  6200,  6456,  6712,  6712,  6968,  6968,  7224,  7480,  7480,  7736,  7992,  7992,  8248,  8248,  8504,  8760,  8760,
+     9144,  9144,  9144,  9528,  9528,  9912,  9912,  10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536,
+     13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568},
+    {144,   328,   504,   680,   872,   1032,  1224,  1384,  1544,  1736,  1928,  2088,  2280,  2472,  2664,  2792,  2984,  3112,  3368,  3496,  3752,  3880,  4008,  4264,  4392,  4584,  4776,  4968,
+     5160,  5352,  5544,  5736,  5736,  5992,  6200,  6200,  6456,  6712,  6712,  6968,  7224,  7480,  7480,  7736,  7992,  7992,  8248,  8504,  8504,  8760,  9144,  9144,  9144,  9528,  9528,  9912,
+     9912,  10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688,
+     14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080},
+    {176,   376,   584,   776,   1000,  1192,  1384,  1608,  1800,  2024,  2216,  2408,  2600,  2792,  2984,  3240,  3496,  3624,  3880,  4008,  4264,  4392,  4584,  4776,  4968,  5352,  5544,  5736,
+     5992,  5992,  6200,  6456,  6712,  6968,  6968,  7224,  7480,  7736,  7736,  7992,  8248,  8504,  8760,  8760,  9144,  9144,  9528,  9528,  9912,  9912,  10296, 10680, 10680, 11064, 11064, 11448,
+     11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992,
+     16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152},
+    {208,   440,   680,   904,   1128,  1352,  1608,  1800,  2024,  2280,  2472,  2728,  2984,  3240,  3368,  3624,  3880,  4136,  4392,  4584,  4776,  4968,  5352,  5544,  5736,  5992,  6200,  6456,
+     6712,  6712,  6968,  7224,  7480,  7736,  7992,  8248,  8504,  8760,  8760,  9144,  9528,  9528,  9912,  9912,  10296, 10680, 10680, 11064, 11064, 11448, 11832, 11832, 12216, 12216, 12576, 12576,
+     12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080,
+     19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 23688, 24496, 24496, 24496, 24496, 25456},
+    {224,   488,   744,   1000,  1256,  1544,  1800,  2024,  2280,  2536,  2856,  3112,  3368,  3624,  3880,  4136,  4392,  4584,  4968,  5160,  5352,  5736,  5992,  6200,  6456,  6712,  6968,  7224,
+     7480,  7736,  7992,  8248,  8504,  8760,  9144,  9144,  9528,  9912,  9912,  10296, 10680, 10680, 11064, 11448, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688,
+     14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384,
+     22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 26416, 27376, 27376, 27376, 27376, 28336, 28336},
+    {256,   552,   840,   1128,  1416,  1736,  1992,  2280,  2600,  2856,  3112,  3496,  3752,  4008,  4264,  4584,  4968,  5160,  5544,  5736,  5992,  6200,  6456,  6968,  7224,  7480,  7736,  7992,
+     8248,  8504,  8760,  9144,  9528,  9912,  9912,  10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 15840,
+     16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 24496,
+     24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704},
+    {280,   600,   904,   1224,  1544,  1800,  2152,  2472,  2728,  3112,  3368,  3624,  4008,  4264,  4584,  4968,  5160,  5544,  5736,  6200,  6456,  6712,  6968,  7224,  7736,  7992,  8248,  8504,
+     8760,  9144,  9528,  9912,  10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992,
+     17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456,
+     26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008},
+    {328,   632,   968,   1288,  1608,  1928,  2280,  2600,  2984,  3240,  3624,  3880,  4264,  4584,  4968,  5160,  5544,  5992,  6200,  6456,  6712,  7224,  7480,  7736,  7992,  8504,  8760,  9144,
+     9528,  9912,  9912,  10296, 10680, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336,
+     18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376,
+     27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 35160},
+    {336,   696,   1064,  1416,  1800,  2152,  2536,  2856,  3240,  3624,  4008,  4392,  4776,  5160,  5352,  5736,  6200,  6456,  6712,  7224,  7480,  7992,  8248,  8760,  9144,  9528,  9912,  10296,
+     10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616,
+     20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576,
+     30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 39232},
+    {376,   776,   1160,  1544,  1992,  2344,  2792,  3112,  3624,  4008,  4392,  4776,  5160,  5544,  5992,  6200,  6712,  7224,  7480,  7992,  8248,  8760,  9144,  9528,  9912,  10296, 10680, 11064,
+     11448, 11832, 12216, 12576, 12960, 13536, 14112, 14112, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152,
+     22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856,
+     34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816},
+    {408,   840,   1288,  1736,  2152,  2600,  2984,  3496,  3880,  4264,  4776,  5160,  5544,  5992,  6456,  6968,  7224,  7736,  8248,  8504,  9144,  9528,  9912,  10296, 10680, 11064, 11448, 12216,
+     12576, 12960, 13536, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19080, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 24496,
+     24496, 25456, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696,
+     36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888},
+    {440,   904,   1384,  1864,  2344,  2792,  3240,  3752,  4136,  4584,  5160,  5544,  5992,  6456,  6968,  7480,  7992,  8248,  8760,  9144,  9912,  10296, 10680, 11064, 11448, 12216, 12576, 12960,
+     13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 20616, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416,
+     26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232,
+     39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 48936, 51024, 51024, 51024},
+    {488,   1000,  1480,  1992,  2472,  2984,  3496,  4008,  4584,  4968,  5544,  5992,  6456,  6968,  7480,  7992,  8504,  9144,  9528,  9912,  10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112,
+     14688, 15264, 15840, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336,
+     28336, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368,
+     42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056},
+    {520,   1064,  1608,  2152,  2664,  3240,  3752,  4264,  4776,  5352,  5992,  6456,  6968,  7480,  7992,  8504,  9144,  9528,  10296, 10680, 11448, 11832, 12576, 12960, 13536, 14112, 14688, 15264,
+     15840, 16416, 16992, 16992, 17568, 18336, 19080, 19080, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576,
+     30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352,
+     45352, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256},
+    {552,   1128,  1736,  2280,  2856,  3496,  4008,  4584,  5160,  5736,  6200,  6968,  7480,  7992,  8504,  9144,  9912,  10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840,
+     16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704,
+     32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936,
+     48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776},
+    {584,   1192,  1800,  2408,  2984,  3624,  4264,  4968,  5544,  5992,  6712,  7224,  7992,  8504,  9144,  9912,  10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992,
+     17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 22920, 23688, 24496, 25456, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008,
+     35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024,
+     52752, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592},
+    {616,   1256,  1864,  2536,  3112,  3752,  4392,  5160,  5736,  6200,  6968,  7480,  8248,  8760,  9528,  10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568,
+     18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160,
+     36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752,
+     55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592, 68808, 68808, 68808, 71112},
+    {712,   1480,  2216,  2984,  3752,  4392,  5160,  5992,  6712,  7480,  8248,  8760,  9528,  10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336, 19080, 19848, 20616,
+     21384, 22152, 22920, 23688, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 40576, 40576, 40576,
+     42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664,
+     61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376}};
 
-unsigned int TBStable1C[32] = {40, 56, 72, 120, 136, 144, 176, 208, 224, 256, 280, 296, 328, 336, 392, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1224, 1288, 1384, 1480, 1608, 1736};
+static const unsigned int TBStable1C[32] = {40,  56,  72,  120, 136, 144, 176, 208,  224,  256,  280,  296,  328,  336,  392,  488,
+                                            552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1224, 1288, 1384, 1480, 1608, 1736};
 #endif
diff --git a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
index 38914506eef4a9a4db776c72cf6fbd16f4bcee92..aca34720d134f97e4c7679ae66b4655cb042823e 100644
--- a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
+++ b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c
@@ -33,6 +33,7 @@
 #include "PHY/defs_common.h"
 #include "PHY/phy_extern.h"
 #include "PHY/LTE_TRANSPORT/transport_common_proto.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 unsigned char get_Qm(unsigned char I_MCS) {
   if (I_MCS < 10)
diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c
index 0ba63019a1f7ba40bb27428c73f3423990641355..ac470c5c4eabc4f562e2407fb1d841e05a80e309 100644
--- a/openair1/PHY/LTE_TRANSPORT/pcfich.c
+++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c
@@ -32,15 +32,10 @@
 #include "PHY/impl_defs_top.h"
 #include "PHY/defs_eNB.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 //#define DEBUG_PCFICH
-extern uint8_t pcfich_b[4][32];
-
-
-void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
-                       uint8_t subframe,
-                       uint8_t *b,
-                       uint8_t *bt)
+void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, uint8_t subframe, const uint8_t *b, uint8_t *bt)
 {
   uint32_t i;
   uint8_t reset;
diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c
index bf03c185ef9664790957fafbb22a2295c8e24bfd..695083d2fe31d57e001fff90875c34230d0a3403 100644
--- a/openair1/PHY/LTE_TRANSPORT/sss.c
+++ b/openair1/PHY/LTE_TRANSPORT/sss.c
@@ -32,6 +32,7 @@
 #include "PHY/defs_eNB.h"
 #include "transport_eNB.h"
 #include "PHY/phy_extern.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 //#define DEBUG_SSS
 
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_extern.h b/openair1/PHY/LTE_TRANSPORT/transport_extern.h
deleted file mode 100644
index 8b33449ccaf06762fc5b786e4969c12c7dfc67c9..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_TRANSPORT/transport_extern.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-extern unsigned int dlsch_tbs25[27][25],TBStable[27][110],TBStable1C[32];
-extern unsigned short lte_cqi_eff1024[16];
-extern char lte_cqi_snr_dB[15];
-extern const short conjugate[8],conjugate2[8];
-extern short minus_one[8];
-extern short minus_one[8];
-extern short *ul_ref_sigs[30][2][34];
-extern short *ul_ref_sigs_rx[30][2][34];
-extern unsigned short dftsizes[34];
-extern unsigned short ref_primes[34];
-
-extern int qam64_table[8],qam16_table[4],qpsk_table[2];
-
-extern unsigned char cs_ri_normal[4];
-extern unsigned char cs_ri_extended[4];
-extern unsigned char cs_ack_normal[4];
-extern unsigned char cs_ack_extended[4];
-
-
-extern unsigned char ue_power_offsets[25];
-
-extern unsigned short scfdma_amps[26];
-
-extern char dci_format_strings[15][13];
-
-extern int16_t *d0_sss,*d5_sss;
-
-extern uint8_t wACK[5][4];
-extern int8_t wACK_RX[5][4];
-
-extern uint32_t bitrev_cc_dci[32];
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 12066e3bc698547f003946c8d183716bba29b715..f18a33ad2df204256807a3c718b536d3f4f6b37c 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -510,16 +510,6 @@ void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_i
 void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
 void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame);
 
-
-
-
-
-void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
-                       uint8_t subframe,
-                       uint8_t *b,
-                       uint8_t *bt);
-
-
 void generate_pcfich(uint8_t num_pdcch_symbols,
                      int16_t amp,
                      LTE_DL_FRAME_PARMS *frame_parms,
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_vars.h b/openair1/PHY/LTE_TRANSPORT/transport_vars.h
index 6ac121dc13c38ff4a39405ff4183232bcc4684b6..3a4c82989bddb9ec4a982278d5e2a33df96ed64d 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_vars.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_vars.h
@@ -19,66 +19,35 @@
  *      contact@openairinterface.org
  */
 
-#include "dlsch_tbs.h"
-//#include "dlsch_tbs_full.h"
-
-unsigned short lte_cqi_eff1024[16] = {156,          //-6, .15234
-                                      240,          //-4  .234
-                                      386,          //-2  .3769
-                                      616,          //1   .6016
-                                      898,          //4   .87695
-                                      1204,         //6   1.1758
-                                      1512,         //8   1.4766
-                                      1960,         //11  1.9141
-                                      2464,         //14  2.4062
-                                      2796,         //16  2.7305
-                                      3402,         //20  3.3223
-                                      3996,         //23  3.9023
-                                      4632,         //27  4.5234
-                                      5238,         //31  5.1152
-                                      5688
-                                     };        //33  5.5547
+#ifndef __TRANSPORT_VARS_H
+#define __TRANSPORT_VARS_H
 
-char lte_cqi_snr_dB[15] = { -2,
-                            0,
-                            1,
-                            2,
-                            4,
-                            6,
-                            10,
-                            14,
-                            18,
-                            22,
-                            26,
-                            30,
-                            34,
-                            38,
-                            40
-                          };
+#include "dlsch_tbs.h"
+#include "dlsch_tbs_full.h"
+static const uint16_t dftsizes[34] = {12,  24,  36,  48,  60,  72,  96,  108, 120, 144, 180, 192, 216, 240, 288,  300,  324,
+                                      360, 384, 432, 480, 540, 576, 600, 648, 720, 768, 864, 900, 960, 972, 1080, 1152, 1200};
 
-unsigned char ue_power_offsets[25] = {14,11,9,8,7,6,6,5,4,4,4,3,3,3,2,2,2,1,1,1,1,1,0,0,0};
+static const unsigned char ue_power_offsets[25] = {14, 11, 9, 8, 7, 6, 6, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0};
 
-int qam64_table[8],qam16_table[4],qpsk_table[2];
+extern int qam64_table[8], qam16_table[4], qpsk_table[2];
 
-unsigned char cs_ri_normal[4]    = {1,4,7,10};
-unsigned char cs_ri_extended[4]  = {0,3,5,8};
-unsigned char cs_ack_normal[4]   = {2,3,8,9};
-unsigned char cs_ack_extended[4] = {1,2,6,7};
+static const unsigned char cs_ri_normal[4] = {1, 4, 7, 10};
+static const unsigned char cs_ri_extended[4] = {0, 3, 5, 8};
+static const unsigned char cs_ack_normal[4] = {2, 3, 8, 9};
+static const unsigned char cs_ack_extended[4] = {1, 2, 6, 7};
 
 //unsigned short scfdma_amps[25] = {0,5120,3620,2956,2560,2290,2090,1935,1810,1706,1619,1544,1478,1420,1368,1322,1280,1242,1207,1175,1145,1117,1092,1068,1045,1024};
 
-char dci_format_strings[15][13] = {"0","1","1A","1B","1C","1D","1E_2A_M10PRB",
-                                   "2","2A","2B","2C","2D",
-                                   "3"
-                                  };
+static const uint8_t wACK[5][4] = {{1, 1, 1, 1}, {1, 0, 1, 0}, {1, 1, 0, 0}, {1, 0, 0, 1}, {0, 0, 0, 0}};
+static const uint32_t bitrev_cc_dci[32] = {1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30};
 
-uint8_t wACK[5][4] = {{1,1,1,1},{1,0,1,0},{1,1,0,0},{1,0,0,1},{0,0,0,0}};
-int8_t wACK_RX[5][4] = {{-1,-1,-1,-1},{-1,1,-1,1},{-1,-1,1,1},{-1,1,1,-1},{1,1,1,1}};
+static const uint8_t pcfich_b[4][32] = {{0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1},
+                                        {1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0},
+                                        {1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1},
+                                        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
-uint32_t bitrev_cc_dci[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30};
+extern short *ul_ref_sigs[30][2][34];
+extern short *ul_ref_sigs_rx[30][2][34];
+extern int16_t *d0_sss, *d5_sss;
 
-uint8_t pcfich_b[4][32]= {{0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1},
-  {1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},
-  {1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1},
-  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
-};
+#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index 51e4d40a3392c2330b711e0cd96a0d3f376518c0..4168962046f4b1d428933558e58f178e36a3b3c9 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -43,10 +43,9 @@
 #include "transport_proto.h"
 #include <executables/split_headers.h>
 
-extern WORKER_CONF_t get_thread_worker_conf(void);
 extern int oai_exit;
 
-
+static const int8_t wACK_RX[5][4] = {{-1, -1, -1, -1}, {-1, 1, -1, 1}, {-1, -1, 1, 1}, {-1, 1, 1, -1}, {1, 1, 1, 1}};
 
 void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) {
   int i,r;
@@ -412,7 +411,7 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,
   unsigned int ret=0;
   //  uint8_t dummy_channel_output[(3*8*block_length)+12];
   int r,Kr;
-  uint8_t *columnset;
+  const uint8_t *columnset;
   unsigned int sumKr=0;
   unsigned int Qprime,L,G,Q_CQI,Q_RI,H,Hprime,Hpp,Cmux,Rmux_prime,O_RCC;
   unsigned int Qprime_ACK,Qprime_RI,len_ACK=0,len_RI=0;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c
index fd851b3abf75a3c3e79b75489f90681614b80f0f..2a003019c71d563d8ef5356a36e829438e305613 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c
@@ -38,7 +38,7 @@
 #include "SCHED_UE/sched_UE.h"
 #include "SIMULATION/TOOLS/sim.h" // for taus
 #include "PHY/sse_intrin.h"
-#include "PHY/LTE_TRANSPORT/transport_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 #include "SCHED/sched_common.h"
 
@@ -2021,8 +2021,18 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars,
         }
 
 #ifdef DEBUG_DCI_DECODING
-        LOG_I(PHY,"[DCI search] Found DCI %d rnti %x Aggregation %d length %d format %s in CCE %d (CCEmap %x) candidate %d / %d \n",
-              *dci_cnt,crc,1<<L,sizeof_bits,dci_format_strings[dci_alloc[*dci_cnt-1].format],CCEind,*CCEmap,m,nb_candidates );
+        static const char dci_format_strings[15][13] = {"0", "1", "1A", "1B", "1C", "1D", "1E_2A_M10PRB", "2", "2A", "2B", "2C", "2D", "3"};
+        LOG_I(PHY,
+              "[DCI search] Found DCI %d rnti %x Aggregation %d length %d format %s in CCE %d (CCEmap %x) candidate %d / %d \n",
+              *dci_cnt,
+              crc,
+              1 << L,
+              sizeof_bits,
+              dci_format_strings[dci_alloc[*dci_cnt - 1].format],
+              CCEind,
+              *CCEmap,
+              m,
+              nb_candidates);
         dump_dci(frame_parms,&dci_alloc[*dci_cnt-1]);
 
 #endif
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c
index 77c0d9ca7afcb12dfc927362b2356d44d3722f6e..9de01688edc3d294df8d765e41284e8ea3f2cdb5 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c
@@ -33,6 +33,7 @@
 #include "PHY/phy_extern_ue.h"
 #include "PHY/sse_intrin.h"
 #include "transport_proto_ue.h"
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 //#define DEBUG_DRS
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
index 740d1be5013d3f2c5685b66fd50809cb71b69cc0..8a8df9268d1a510007985d1d17a5da3f8c034812 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
@@ -33,11 +33,7 @@
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 
 //#define DEBUG_PCFICH
-
-extern uint8_t pcfich_b[4][32];
-
-
-
+#include "openair1/PHY/LTE_TRANSPORT/transport_vars.h"
 
 void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
                          uint8_t subframe,
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
index c04ec160aa1b80356a74d52dd64fbada063b4270..f7566abebfa1d07d493ffa32e1aee3e7f89aff43 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
@@ -174,7 +174,7 @@ uint32_t ulsch_encoding(uint8_t *a,
   uint8_t Q_m=0;
   uint32_t Kr=0,Kr_bytes,r,r_offset=0;
   uint8_t y[6*14*1200],*yptr;;
-  uint8_t *columnset;
+  const uint8_t *columnset;
   uint32_t sumKr=0;
   uint32_t Qprime,L,G,Q_CQI=0,Q_RI=0,Q_ACK=0,H=0,Hprime=0,Hpp=0,Cmux=0,Rmux=0,Rmux_prime=0;
   uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0;
diff --git a/openair1/PHY/MODULATION/modulation_extern.h b/openair1/PHY/MODULATION/modulation_extern.h
index 417ae5781be75e02c4ab71a1d35a9bc1284568f6..8cbf13b1d442f1c7dfb8c9311baf92d7a9807313 100644
--- a/openair1/PHY/MODULATION/modulation_extern.h
+++ b/openair1/PHY/MODULATION/modulation_extern.h
@@ -35,10 +35,10 @@ extern int16_t *s75e_kHz_7_5;
 extern int16_t *s100n_kHz_7_5;
 extern int16_t *s100e_kHz_7_5;
 
+static const short conjugate75[8] __attribute__((aligned(16))) = {-1, 1, -1, 1, -1, 1, -1, 1};
+static const short conjugate75_2[8] __attribute__((aligned(16))) = {1, -1, 1, -1, 1, -1, 1, -1};
+static const short negate[8] __attribute__((aligned(16))) = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-extern short conjugate75[8];
-extern short conjugate75_2[8];
-extern short negate[8];
 #ifdef __cplusplus
 }
 #endif
diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c b/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c
index ff00d251981884a5cda73e2c77673e7552d84bee..c6ddbe61979643248272bd002088e258e9ff1ad5 100644
--- a/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c
+++ b/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c
@@ -25,10 +25,6 @@
 #include <math.h>
 #include "PHY/sse_intrin.h"
 
-extern short conjugate75[8];
-extern short conjugate75_2[8];
-extern short negate[8];
-
 void apply_7_5_kHz(PHY_VARS_UE *ue,int32_t*txdata,uint8_t slot)
 {
 
diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c
index b14b64b1a806b63a5adb01e82d80a2f3e6d5ea5d..56787efd6f615e32b32907c2980816c3504c592a 100644
--- a/openair1/PHY/TOOLS/oai_dfts.c
+++ b/openair1/PHY/TOOLS/oai_dfts.c
@@ -10024,40 +10024,6 @@ int main(int argc, char**argv)
   printf("\n\n49152-point(%f cycles)\n",(double)ts.diff/(double)ts.trials);
   LOG_M("y49152.m","y49152",y,49152,1,1);
   LOG_M("x49152.m","x49152",x,49152,1,1);
-  /*
-  int dftsizes[33]={24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,768,864,900,960,972,1080,1152,1200};
-  void (*dft)(int16_t *x,int16_t *y,uint8_t scale)[33] = {dft24,dft36,dft48,dft60,dft72,dft96,dft108,dft120,dft144,dft180,dft192,dft216,dft240,dft288,dft300,dft324,dft360,dft384,dft432,dft480,dft540,dft576,dft600,dft648,dft720,dft768,dft864,dft900,dft960,dft972,dft1080,dft1152,dft1200};
-  for (int n=0;n<33;n++) {
-    // 4xN-point DFT
-    memset((void*)x,0,dftsizes[n]*8*sizeof(int16_t));
-    for (i=0;i<dftsizes[n]*8;i+=8) {
-      if ((taus() & 1)==0)
-	((int16_t*)x)[i]   = 364;
-      else
-	((int16_t*)x)[i]   = -364;
-      if ((taus() & 1)==0)
-	((int16_t*)x)[i+1] = 364;
-      else
-	((int16_t*)x)[i+1] = -364;
-    }
-    
-    reset_meas(&ts);
-    for (i=0; i<10000; i++) {
-      start_meas(&ts);
-      (dft[n])((int16_t *)x,(int16_t *)y,1);
-      stop_meas(&ts);
-    }
-    
-    printf("\n\n4x%d-point(%f cycles)\n",dftsizes[n],(double)ts.diff/(double)ts.trials);
-    char ystr[5],xstr[5],ystr2[5],xstr2[5];
-    sprintf(ystr,"y%d.m",dftsizes[n]);
-    sprintf(xstr,"x%d.m",dftsizes[n]);
-    sprintf(ystr2,"y%d",dftsizes[n]);
-    sprintf(xstr2,"x%d",dftsizes[n]);
-    LOG_M(ystr,ystr2,y,dftsizes[n]*4,1,1);
-    LOG_M(xstr,xstr2,x,dftsizes[n]*4,1,1);
-  }
-  */
 
   return(0);
 }
diff --git a/openair1/PHY/TOOLS/tools_vars.h b/openair1/PHY/TOOLS/tools_vars.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair1/PHY/TOOLS/tools_vars.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h
index 1ce042d086dfab93902d7c55cc6b10c18749966d..71db7df2bdca42829df2600ec3890bc438a5b2eb 100644
--- a/openair1/PHY/phy_extern.h
+++ b/openair1/PHY/phy_extern.h
@@ -31,7 +31,7 @@ extern  char fmageren_name2[512];
 extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
 extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
 
-#include "PHY/LTE_TRANSPORT/transport_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 #include "PHY/defs_RU.h"
 
 extern unsigned int DAQ_MBOX;
@@ -97,7 +97,6 @@ extern unsigned short Nb_41_60[8][4];
 extern unsigned short Nb_61_80[8][4];
 extern unsigned short Nb_81_110[8][4];
 
-extern uint16_t hundred_times_log10_NPRB[100];
 extern uint8_t alpha_lut[8];
 extern uint8_t max_turbo_iterations;
 #endif /*__PHY_EXTERN_H__ */
diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h
index cff03e375d810d46388b512c7343c67aa8fef74a..0249ed0147a6abab503f1c1ee03e606f250b046a 100644
--- a/openair1/PHY/phy_extern_ue.h
+++ b/openair1/PHY/phy_extern_ue.h
@@ -31,7 +31,7 @@ extern  char fmageren_name2[512];
 extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
 extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
 
-#include "PHY/LTE_TRANSPORT/transport_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 extern int number_of_cards;
 
@@ -96,7 +96,6 @@ extern unsigned short Nb_41_60[8][4];
 extern unsigned short Nb_61_80[8][4];
 extern unsigned short Nb_81_110[8][4];
 
-extern uint16_t hundred_times_log10_NPRB[100];
 extern uint8_t alpha_lut[8];
 extern uint8_t max_turbo_iterations;
 #endif /*__PHY_EXTERN_H__ */
diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h
index d99a3016ba6a07a012cb9a6f1640c156fedd495f..b1899639fbdd2f1210897334104737bc71adee13 100644
--- a/openair1/PHY/phy_vars.h
+++ b/openair1/PHY/phy_vars.h
@@ -34,9 +34,7 @@ char* namepointer_log2;
 
 #include "PHY/LTE_REFSIG/primary_synch.h"
 
-
 #include "PHY/LTE_TRANSPORT/transport_vars.h"
-#include "PHY/MODULATION/modulation_vars.h"
 
 #include "nfapi/oai_integration/vendor_ext.h"
 
@@ -52,9 +50,6 @@ unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048]
 const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
 
-
-#include "SIMULATION/ETH_TRANSPORT/vars.h"
-
 unsigned char NB_RU=0;
 
 int number_of_cards;
diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h
index 87f350d1797007e792d1493c89b6ff75b05a7fbe..024ab5017aef8ccc9f3809cd8659ac1145e6f831 100644
--- a/openair1/PHY/phy_vars_nr_ue.h
+++ b/openair1/PHY/phy_vars_nr_ue.h
@@ -52,9 +52,6 @@ unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048]
 const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
 
-
-#include "SIMULATION/ETH_TRANSPORT/vars.h"
-
 unsigned char NB_RU=0;
 
 
diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h
index 2cdec82f0f9565a9fd2519c7460ff476ad531e43..92a135b44ea318163e46a037935186de14e510c2 100644
--- a/openair1/PHY/phy_vars_ue.h
+++ b/openair1/PHY/phy_vars_ue.h
@@ -43,10 +43,6 @@ unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048]
 const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
 
-
-#include "SIMULATION/ETH_TRANSPORT/vars.h"
-
-
 int number_of_cards;
 
 
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index ecfec02193d498d9f167bb1e5278a46f3c5eafee..f7aa81c199a3b9648357b1381906ed3f9bfec095 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -32,13 +32,14 @@
 
 #include "PHY/defs_eNB.h"
 #include "PHY/LTE_TRANSPORT/transport_proto.h"
-#include "PHY/LTE_TRANSPORT/transport_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 #include "SCHED/sched_eNB.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 #include "nfapi_pnf_interface.h"
 #include "fapi_l1.h"
 
 #include "common/ran_context.h"
+#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h"
 extern RAN_CONTEXT_t RC;
 
 int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req);
diff --git a/openair1/SCHED/sched_common_extern.h b/openair1/SCHED/sched_common_extern.h
index 2236c5f31dc6d8002c3db22baa3c8e39db1f1403..57d70f7d1ea6de358fd9e8d36227c7e45358597d 100644
--- a/openair1/SCHED/sched_common_extern.h
+++ b/openair1/SCHED/sched_common_extern.h
@@ -26,8 +26,17 @@
 
 #include "sched_eNB.h"
 
-extern int16_t hundred_times_delta_TF[100];
-extern uint16_t hundred_times_log10_NPRB[100];
+// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
+static const int16_t hundred_times_delta_TF[100] = {-32768, -1268, -956, -768, -631, -523, -431, -352, -282, -219, -161, -107, -57,  -9,   36,   79,   120,  159,  197,  234,
+                                                    269,    304,   337,  370,  402,  434,  465,  495,  525,  555,  583,  612,  640,  668,  696,  723,  750,  777,  803,  829,
+                                                    856,    881,   907,  933,  958,  983,  1008, 1033, 1058, 1083, 1108, 1132, 1157, 1181, 1205, 1229, 1254, 1278, 1302, 1325,
+                                                    1349,   1373,  1397, 1421, 1444, 1468, 1491, 1515, 1538, 1562, 1585, 1609, 1632, 1655, 1679, 1702, 1725, 1748, 1772, 1795,
+                                                    1818,   1841,  1864, 1887, 1910, 1933, 1956, 1980, 2003, 2026, 2049, 2072, 2095, 2118, 2141, 2164, 2186, 2209, 2232, 2255};
+static const uint16_t hundred_times_log10_NPRB[100] = {0,    301,  477,  602,  698,  778,  845,  903,  954,  1000, 1041, 1079, 1113, 1146, 1176, 1204, 1230, 1255, 1278, 1301,
+                                                       1322, 1342, 1361, 1380, 1397, 1414, 1431, 1447, 1462, 1477, 1491, 1505, 1518, 1531, 1544, 1556, 1568, 1579, 1591, 1602,
+                                                       1612, 1623, 1633, 1643, 1653, 1662, 1672, 1681, 1690, 1698, 1707, 1716, 1724, 1732, 1740, 1748, 1755, 1763, 1770, 1778,
+                                                       1785, 1792, 1799, 1806, 1812, 1819, 1826, 1832, 1838, 1845, 1851, 1857, 1863, 1869, 1875, 1880, 1886, 1892, 1897, 1903,
+                                                       1908, 1913, 1919, 1924, 1929, 1934, 1939, 1944, 1949, 1954, 1959, 1963, 1968, 1973, 1977, 1982, 1986, 1991, 1995, 2000};
 
 void kill_fep_thread(RU_t *ru);
 
diff --git a/openair1/SCHED/sched_common_vars.h b/openair1/SCHED/sched_common_vars.h
deleted file mode 100644
index 8886e0d576bae75c8e088e9131d9dea4b00e2d19..0000000000000000000000000000000000000000
--- a/openair1/SCHED/sched_common_vars.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdint.h>
-#include <openair1/SCHED/sched_common_extern.h>
-
-
-// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
-int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255};
-uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000};
-
diff --git a/openair1/SCHED_UE/srs_pc.c b/openair1/SCHED_UE/srs_pc.c
index 9463db2cd62b594db9fad1adeb7514fbcd34516e..8026eb8307966df463e014f026981365b062ba2f 100644
--- a/openair1/SCHED_UE/srs_pc.c
+++ b/openair1/SCHED_UE/srs_pc.c
@@ -34,6 +34,7 @@
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/phy_extern_ue.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
+#include "openair1/SCHED/sched_common_extern.h"
 
 void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag)
 {
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
index e96db24521f8772a19ce1a7e0d202219604c42dd..a64e02abf7f29fce1c54c6348fd5230b7319e67e 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
@@ -39,7 +39,7 @@
 #include "UTIL/LOG/log.h"
 
 #include "multicast_link.h"
-
+#include "openair1/SIMULATION/ETH_TRANSPORT/extern.h"
 char rx_bufferP[BYPASS_RX_BUFFER_SIZE];
 unsigned int num_bytesP = 0;
 int      N_P = 0, N_R = 0;
@@ -57,6 +57,10 @@ mapping transport_names[] = {
   {"RELEASE TRANSPORT INFO", EMU_TRANSPORT_INFO_RELEASE},
   {NULL, -1}
 };
+static pthread_mutex_t emul_low_mutex;
+static pthread_mutex_t emul_low_mutex;
+static pthread_cond_t emul_low_cond;
+static char emul_low_mutex_var;
 
 void init_bypass (void)
 {
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
index 03fbfeffe0f2cf3e77b1324f3b7fe0050d2f42a3..9d209043fd67a8dd1d43409f15585c7f636360dd 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
@@ -39,6 +39,27 @@
 #include "UTIL/OCG/OCG_extern.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
+#include "openair1/SIMULATION/ETH_TRANSPORT/extern.h"
+unsigned char Emulation_status;
+unsigned char emu_tx_status;
+unsigned char emu_rx_status;
+
+#if !defined(ENABLE_NEW_MULTICAST)
+pthread_mutex_t Tx_mutex;
+pthread_cond_t Tx_cond;
+char Tx_mutex_var;
+#endif
+
+/* Handlers for RX and TX */
+rx_handler_t rx_handler;
+tx_handler_t tx_handler;
+
+eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
+uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
+
+UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
+
+UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
 
 extern unsigned int Master_list_rx;
 
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/extern.h b/openair1/SIMULATION/ETH_TRANSPORT/extern.h
index 826317b5388ee56cb7cc196013bac3716234a1d9..ecd0d301d67ed9bb86c983565345914da0a581f5 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/extern.h
+++ b/openair1/SIMULATION/ETH_TRANSPORT/extern.h
@@ -42,9 +42,6 @@ extern unsigned char emu_rx_status;
 //extern unsigned int Is_primary_master;
 
 #if !defined(ENABLE_NEW_MULTICAST)
-extern pthread_mutex_t emul_low_mutex;
-extern pthread_cond_t emul_low_cond;
-extern char emul_low_mutex_var;
 extern pthread_mutex_t Tx_mutex;
 extern pthread_cond_t Tx_cond;
 extern char Tx_mutex_var;
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
index 988052ca82736b80bfe3f998ce0a46af581e9b3a..837d977f65addd14ba36f544139f0090bf9421a0 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -38,7 +38,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/vars.h b/openair1/SIMULATION/ETH_TRANSPORT/vars.h
deleted file mode 100644
index 9368d622c65d71110e5b09aa61fef1343ffe38e3..0000000000000000000000000000000000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/vars.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file vars.h
-* \brief specifies the variables for phy emulation
-* \author Navid Nikaein and Raymomd Knopp and Hicham Anouar
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr
-*/
-
-#include <pthread.h>
-#include "defs.h"
-
-#ifndef __BYPASS_SESSION_LAYER_VARS_H__
-#    define __BYPASS_SESSION_LAYER_VARS_H__
-
-unsigned char Emulation_status;
-unsigned char emu_tx_status;
-unsigned char emu_rx_status;
-//unsigned int Master_list=0;
-//unsigned short Master_id;
-//unsigned int Is_primary_master;
-
-#if !defined(ENABLE_NEW_MULTICAST)
-pthread_mutex_t emul_low_mutex;
-pthread_cond_t emul_low_cond;
-char emul_low_mutex_var;
-pthread_mutex_t Tx_mutex;
-pthread_cond_t Tx_cond;
-char Tx_mutex_var;
-#endif
-
-/* Handlers for RX and TX */
-rx_handler_t rx_handler;
-tx_handler_t tx_handler;
-
-eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-
-UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
-
-UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
-
-#endif
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index dcaff8f0889295d5e59a5e508516c2878ae09f16..0002981f78594680523cfc42302a30d7dfaec8a6 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -37,7 +37,6 @@
 #include <signal.h>
 #include "common/config/config_load_configmodule.h"
 #include "common/utils/LOG/log.h"
-#include "LAYER2/MAC/mac_vars.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 #include "PHY/types.h"
 #include "PHY/defs_eNB.h"
@@ -51,7 +50,6 @@
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/TOOLS/lte_phy_scope.h"
 #include "SCHED/sched_eNB.h"
-#include "SCHED/sched_common_vars.h"
 #include "SCHED_UE/sched_UE.h"
 #include "SIMULATION/TOOLS/sim.h"
 #include "UTIL/LISTS/list.h"
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
index 2f254ea3d220923822ec8d077a36a3e9711721d0..547d2cfa28ceb67e36027f5d9dfdfde98f3eca5c 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
@@ -51,9 +51,6 @@
 
 #include "unitary_defs.h"
 
-extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
-extern unsigned char offset_mumimo_llr_drange_fix;
-
 #include "PHY/TOOLS/lte_phy_scope.h"
 
 PHY_VARS_eNB *eNB;
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 0f7a1375ff85395d4f216441e572c946393a0f49..390bf8c73f78e5404c0e875a36ebe663cf3daf22 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -43,7 +43,6 @@
 #include "PHY/phy_vars.h"
 
 #include "SCHED/sched_eNB.h"
-#include "SCHED/sched_common_vars.h"
 #include "LAYER2/MAC/mac_vars.h"
 
 #include "OCG_vars.h"
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 60c658913eb92621994fb8bcc7b3d7eca36ffcab..27a8722ea57d6981c01493d65728c21fee8dbdf6 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -33,7 +33,6 @@
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
-#include "LAYER2/MAC/mac_vars.h"
 #include "PHY/types.h"
 #include "PHY/defs_common.h"
 #include "PHY/defs_eNB.h"
@@ -43,7 +42,6 @@
 #include "PHY/LTE_TRANSPORT/transport_proto.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/TOOLS/lte_phy_scope.h"
-#include "SCHED/sched_common_vars.h"
 #include "SCHED/sched_eNB.h"
 #include "SCHED_UE/sched_UE.h"
 #include "SIMULATION/TOOLS/sim.h"
diff --git a/openair1/SIMULATION/LTE_PHY/unitary_defs.h b/openair1/SIMULATION/LTE_PHY/unitary_defs.h
index 342fa18fb9645db1dfa0e3152e0739cb026c3845..d77682c89ec42d48c0f7b3b4690d6b58e1f7ad87 100644
--- a/openair1/SIMULATION/LTE_PHY/unitary_defs.h
+++ b/openair1/SIMULATION/LTE_PHY/unitary_defs.h
@@ -28,8 +28,4 @@ void exit_function(const char* file, const char* function, const int line,const
    exit(-1);
 }
 
-extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
 extern unsigned char offset_mumimo_llr_drange_fix;
-
-extern unsigned short dftsizes[34];
-extern short *ul_ref_sigs[30][2][34];
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index 5d1cbb7fbe93a96dbde65380ce4eead622560ca3..bacd100114b727b703a59fba97037046007074f3 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -63,7 +63,7 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4];
 
 double cpuf;
 //uint8_t nfapi_mode = 0;
-uint16_t NB_UE_INST = 1;
+const int NB_UE_INST = 1;
 
 uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
 const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 43ecec10d24f0995f3a5de6660f8eb67657cd1a9..134174e7cf01b3bc4097ee7d9b98c54c50a24330 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -68,7 +68,6 @@
 #include "SIMULATION/LTE_PHY/common_sim.h"
 #include "PHY/NR_REFSIG/dmrs_nr.h"
 
-#include <openair2/LAYER2/MAC/mac_vars.h>
 #include <openair2/RRC/LTE/rrc_vars.h>
 
 #include <executables/softmodem-common.h>
@@ -372,6 +371,7 @@ nrUE_params_t *get_nrUE_params(void) {
 
 void do_nothing(void *args) {
 }
+int NB_UE_INST = 1;
 
 int main(int argc, char **argv)
 {
@@ -414,7 +414,6 @@ int main(int argc, char **argv)
 
   SCM_t channel_model = AWGN; // AWGN Rayleigh1 Rayleigh1_anticorr;
 
-  NB_UE_INST = 1;
   //double pbch_sinr;
   //int pbch_tx_ant;
   int N_RB_DL=106,mu=1;
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index cb193e83e859e57a8a09458e5b88c99fcc5e35f3..7d0be095859dc66029c75583d1944be4f8542e2e 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -60,7 +60,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
 
 double cpuf;
 //uint8_t nfapi_mode = 0;
-uint16_t NB_UE_INST = 1;
+const int NB_UE_INST = 1;
 
 // needed for some functions
 openair0_config_t openair0_cfg[MAX_CARDS];
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index 2ec2faeddeb6a6af2dcce48884954ab7f97b5816..fd145c568f56b0b8bf151e1d2fc7bcffd2a4a6f9 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -47,7 +47,6 @@
 #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
 #include "nr_unitary_defs.h"
 #include "OCG_vars.h"
-#include <openair2/LAYER2/MAC/mac_vars.h>
 #include <openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h>
 #include <openair2/RRC/LTE/rrc_vars.h>
 #include <executables/softmodem-common.h>
@@ -233,6 +232,7 @@ nrUE_params_t *get_nrUE_params(void) {
 nr_bler_struct nr_bler_data[NR_NUM_MCS];
 
 void processSlotTX(void *arg) {}
+int NB_UE_INST = 1;
 
 int main(int argc, char **argv){
 
@@ -252,7 +252,6 @@ int main(int argc, char **argv){
   uint8_t config_period;
   int prachOccasion = 0;
   double DS_TDL = .03;
-  NB_UE_INST=1;
 
   //  int8_t interf1=-19,interf2=-19;
   //  uint8_t abstraction_flag=0,calibration_flag=0;
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 04976c1dc016a488ad73c3da85fe06012dacc9ae..ca29219e31209ff3ada6a89b669a30a2f1dd7351 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -59,7 +59,7 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4];
 
 double cpuf;
 //uint8_t nfapi_mode = 0;
-uint16_t NB_UE_INST = 1;
+const int NB_UE_INST = 1;
 uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
 const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c
index 54e0f2b87d3180bc88c46e739776548ef1d115eb..39ab2273e76055df2a2372dc17d5b1b07880e38e 100644
--- a/openair1/SIMULATION/NR_PHY/ulschsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulschsim.c
@@ -66,7 +66,7 @@ const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
 const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
 double cpuf;
 //uint8_t nfapi_mode = 0;
-uint16_t NB_UE_INST = 1;
+const int NB_UE_INST = 1;
 
 // needed for some functions
 PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index cd776b009d4469be328413f350147fb15ef640f9..210b33774e9733f33f581b8caa07002a719a87e0 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -61,7 +61,6 @@
 #define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
 #include "SIMULATION/LTE_PHY/common_sim.h"
 
-#include <openair2/LAYER2/MAC/mac_vars.h>
 #include <openair2/RRC/LTE/rrc_vars.h>
 
 #include <executables/softmodem-common.h>
@@ -267,6 +266,7 @@ uint16_t n_rnti = 0x1234;
 openair0_config_t openair0_cfg[MAX_CARDS];
 
 channel_desc_t *UE2gNB[NUMBER_OF_UE_MAX][NUMBER_OF_gNB_MAX];
+int NB_UE_INST = 1;
 
 int main(int argc, char **argv)
 {
@@ -295,8 +295,6 @@ int main(int argc, char **argv)
   corr_level_t corr_level = CORR_LEVEL_LOW;
   uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
 
-  NB_UE_INST = 1;
-
   //unsigned char frame_type = 0;
   NR_DL_FRAME_PARMS *frame_parms;
   int loglvl = OAILOG_WARNING;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
index 2302c50ab190149c16be4ea5d0ff8452a8941086..9c96d39534bac13c74220e7f3cc338263699e53c 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
@@ -44,8 +44,6 @@
 /* to declare ue variables */
 #include "PHY/phy_vars_nr_ue.h"
 #include "PHY/LTE_TRANSPORT/transport_vars.h"
-#include "SCHED/sched_common_vars.h"
-#include "PHY/MODULATION/modulation_vars.h"
 
 #include "PHY/NR_REFSIG/pss_nr.h"
 #include "PHY/NR_REFSIG/sss_nr.h"
diff --git a/openair1/SIMULATION/TOOLS/channel_sim.c b/openair1/SIMULATION/TOOLS/channel_sim.c
index de8db5d7cb431723ebfe329736fbefa5afa03f3c..7a1a77d3e183c6266ebc2afdc576d2753bdebe3e 100644
--- a/openair1/SIMULATION/TOOLS/channel_sim.c
+++ b/openair1/SIMULATION/TOOLS/channel_sim.c
@@ -69,16 +69,16 @@ void do_DL_sig(sim_t *sim,
 
   double s_re0[30720];
   double s_re1[30720];
-  double *s_re[RC.nb_RU];
+  double *s_re[NB_ANTENNAS_TX];
   double s_im0[30720];
   double s_im1[30720];
-  double *s_im[RC.nb_RU];
+  double *s_im[NB_ANTENNAS_TX];
   double r_re00[30720];
   double r_re01[30720];
-  double *r_re0[RC.nb_RU];
+  double *r_re0[NB_ANTENNAS_RX];
   double r_im00[30720];
   double r_im01[30720];
-  double *r_im0[RC.nb_RU];
+  double *r_im0[NB_ANTENNAS_RX];
   LTE_DL_FRAME_PARMS *frame_parms;
 
   s_re[0] = s_re0;
@@ -295,14 +295,7 @@ void do_DL_sig(sim_t *sim,
   
 }
 
-
-void do_UL_sig(sim_t *sim,
-               uint16_t subframe,
-               uint8_t abstraction_flag,
-               LTE_DL_FRAME_PARMS *frame_parms,
-               uint32_t frame,
-               int ru_id,
-               uint8_t CC_id)
+void do_UL_sig(sim_t *sim, uint16_t subframe, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, int ru_id, uint8_t CC_id, int NB_UE_INST)
 {
   int32_t **txdata,**rxdata;
   uint8_t UE_id=0;
@@ -319,16 +312,16 @@ void do_UL_sig(sim_t *sim,
 
   double s_re0[30720];
   double s_re1[30720];
-  double *s_re[NB_UE_INST];
+  double *s_re[NB_ANTENNAS_TX];
   double s_im0[30720];
   double s_im1[30720];
-  double *s_im[NB_UE_INST];
+  double *s_im[NB_ANTENNAS_TX];
   double r_re00[30720];
   double r_re01[30720];
-  double *r_re0[NB_UE_INST];
+  double *r_re0[NB_ANTENNAS_RX];
   double r_im00[30720];
   double r_im01[30720];
-  double *r_im0[NB_UE_INST];
+  double *r_im0[NB_ANTENNAS_RX];
 
   s_re[0] = s_re0;
   s_im[0] = s_im0;
diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h
index b23aaac4b5e84dfe7737bbeb56a69daf0d33c6da..e530a3a3d083179396bd022ed5839bec86570805 100644
--- a/openair1/SIMULATION/TOOLS/sim.h
+++ b/openair1/SIMULATION/TOOLS/sim.h
@@ -288,7 +288,7 @@ typedef enum {
     {CHANNELMOD_MODEL_DT_PNAME,    "delay spread for TDL models\n",    0,  dblptr:NULL,              defdblval:0,                     TYPE_DOUBLE,    0 }\
 }
 
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 
 typedef struct {
   channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
@@ -573,12 +573,6 @@ void do_DL_sig(sim_t *sim,
                uint8_t UE_id,
                int CC_id);
 
-void do_UL_sig(sim_t *sim,
-               uint16_t subframe,
-               uint8_t abstraction_flag,
-               LTE_DL_FRAME_PARMS *frame_parms,
-               uint32_t frame,
-               int ru_id,
-               uint8_t CC_id);
+void do_UL_sig(sim_t *sim, uint16_t subframe, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, int ru_id, uint8_t CC_id, int NB_UEs);
 
 #endif
diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h
index 4ba50c47e56ac69637ac1948cac27dc3ab447729..7c784a0c355c0b2dc9fe430ac2a43711ceacc279 100644
--- a/openair2/COMMON/gtpv1_u_messages_types.h
+++ b/openair2/COMMON/gtpv1_u_messages_types.h
@@ -23,7 +23,7 @@
 #define GTPV1_U_MESSAGES_TYPES_H_
 
 #include "LTE_asn_constant.h"
-
+#include "NR_asn_constant.h"
 
 #define GTPV1U_MAX_BEARERS_PER_UE max_val_LTE_DRB_Identity
 #define NR_GTPV1U_MAX_BEARERS_PER_UE max_val_NR_DRB_Identity
diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h
index d258bb872ae4f7b026f0fae76a83534d1c47a5aa..b159b3e11b04184940445664203a454838f941a4 100644
--- a/openair2/COMMON/mac_rrc_primitives.h
+++ b/openair2/COMMON/mac_rrc_primitives.h
@@ -24,7 +24,7 @@
 
 #include "LAYER2/RLC/rlc.h"
 #include "COMMON/platform_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "openair2/RRC/LTE/rrc_defs.h"
 
 #include "LTE_RadioResourceConfigCommonSIB.h"
@@ -324,53 +324,6 @@ typedef struct {  //RRC_INTERFACE_FUNCTIONS
   double (*rrc_get_estimated_ue_distance) (module_id_t Mod_id, uint8_t UE_id, uint8_t CC_id, uint8_t loc_type);
 } RRC_XFACE;
 
-
-typedef struct {
-  //MAC_INTERFACE_FUNCTIONS
-  unsigned int frame;
-  unsigned short Node_id[NB_MODULES_MAX];
-  char Is_cluster_head[NB_MODULES_MAX];
-  void (*macphy_exit)(const char *);          /*  Pointer function that stops the low-level scheduler due an exit condition */
-  unsigned short (*mac_config_req)(uint8_t,uint8_t,MAC_CONFIG_REQ *);
-  MAC_MEAS_REQ_ENTRY *(*mac_meas_req)(uint8_t,  MAC_MEAS_REQ *);
-  void (*mac_out_of_sync_ind)(uint8_t,uint32_t,unsigned short);
-  //RLC_INTERFACE_FUNCTIONS
-  void (*pdcp_run)(void);
-  void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char *);
-  signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t );
-  int (*rrc_mac_config_req)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t UE_id,uint8_t eNB_index,
-                            LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
-                            struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
-                            LTE_MAC_MainConfig_t *mac_MainConfig,
-                            long logicalChannelIdentity,
-                            LTE_LogicalChannelConfig_t *logicalChannelConfig,
-                            LTE_MeasGapConfig_t *measGapConfig,
-                            LTE_TDD_Config_t *tdd_Config,
-                            uint8_t *SIwindowsize,
-                            uint16_t *SIperiod,
-                            MBMS_flag_t MBMS_Flag,
-                            struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList,
-                            LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
-                            struct LTE_PMCH_InfoList_r9 *pmch_InfoList
-                           );
-  unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, const unsigned int,char *
-                                   ,uint32_t
-                                   ,uint32_t
-                                  );
-  void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char *, tb_size_t, num_tb_t, crc_t * );
-  mac_rlc_status_resp_t (*mac_rlc_status_ind)     (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, sub_frame_t subframeP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP,
-      logical_chan_id_t channel_idP, tb_size_t tb_sizeP
-      ,uint32_t sourceL2Id
-      ,uint32_t destinationL2Id
-                                                  );
-  signed int (*rrc_rlc_data_req)(module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
-  void (*rrc_rlc_register_rrc) (void (*rrc_data_indP)(module_id_t, rb_id_t, sdu_size_t, char * ),
-                                void  (*rrc_data_confP) (module_id_t, rb_id_t, mui_t ) ) ;
-  void (*mrbch_phy_sync_failure) (uint8_t Mod_id, frame_t frame, uint8_t Free_ch_index);
-  void (*dl_phy_sync_success) (uint8_t Mod_id, frame_t frame, uint8_t eNB_index);
-} MAC_RLC_XFACE;
-
-
 //#define IDLE 0
 #define NEED_RADIO_CONFIG 3
 #define RADIO_CONFIG_TX 2
diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h
deleted file mode 100644
index 47dac57832a97134c6b48a6d7ceeeadf8c21eace..0000000000000000000000000000000000000000
--- a/openair2/COMMON/platform_constants.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*
-                                 platform_constants.h
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER and Navid Nikaein
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
- ***************************************************************************/
-
-
-#ifndef __PLATFORM_CONSTANTS_H__
-#    define __PLATFORM_CONSTANTS_H__
-
-#include "LTE_asn_constant.h"
-#include "NR_asn_constant.h"
-#define NR_MAXDRB 14
-
-#ifdef JUMBO_FRAME
-  #define NL_MAX_PAYLOAD 18000  /* this should cover the max mtu size*/
-#else
-  #define NL_MAX_PAYLOAD 9000  /* this should cover the max mtu size*/
-#endif
-
-#ifdef LARGE_SCALE
-  #define NB_MODULES_MAX 128
-  #define NB_NODE_MAX    128
-#else
-  #define NB_MODULES_MAX 32
-  #define NB_NODE_MAX    32
-#endif
-
-#ifdef JUMBO_FRAME
-  #define MAX_IP_PACKET_SIZE         10000 // 9000
-#else
-  #if defined(OAI_NW_DRIVER_TYPE_ETHERNET)
-    /* SR: When using ethernet network driver the packet size is 1512 :
-    * 1500 bytes IP packet + 14 bytes ethernet header
-    */
-    #define MAX_IP_PACKET_SIZE          1514
-  #else
-    #define MAX_IP_PACKET_SIZE          1500 // 3000
-  #endif
-#endif
-// overwrite the previous deinitions
-
-#    define MAX_MODULES                NB_MODULES_MAX
-#define MAX_NR_RRC_UE_CONTEXTS 64
-
-#ifndef UE_EXPANSION
-    #ifdef LARGE_SCALE
-      #define MAX_MOBILES_PER_ENB         128
-      #define MAX_MOBILES_PER_ENB_NB_IoT  128
-      #define MAX_MOBILES_PER_GNB         128
-      #define MAX_eNB                      2
-      #define MAX_gNB                      2
-    #else
-      #define MAX_MOBILES_PER_ENB         40
-      #define MAX_MOBILES_PER_ENB_NB_IoT  40
-      #define MAX_MOBILES_PER_GNB         16
-      #define MAX_eNB                      2
-      #define MAX_gNB                      2
-    #endif
-#else
-  #define MAX_MOBILES_PER_ENB         256
-  #define MAX_MOBILES_PER_ENB_NB_IoT  256
-  #define MAX_MOBILES_PER_GNB         256
-  #define MAX_eNB                      2
-  #define MAX_gNB                      2
-#endif
-
-#define NUMBER_OF_NR_UCI_STATS_MAX 16
-#define MAX_MANAGED_ENB_PER_MOBILE  2
-#define MAX_MANAGED_GNB_PER_MOBILE  2
-
-///NB-IOT
-#define NB_RB_MAX_NB_IOT  (LTE_maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5
-
-
-#define DEFAULT_RAB_ID 1
-
-#define NB_RB_MAX      (LTE_maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
-#define NR_NB_RB_MAX   (NR_maxDRB + 3)
-
-#define NGAP_MAX_PDU_SESSION (256)  /* As defined in TS 38.413 9.2.1.1 Range Bound for PDU Sessions. */
-#define NGAP_MAX_DRBS_PER_UE (32)   /* As defined in TS 38.413 9.2.1.1 - maxnoofDRBs */
-
-#define NB_RB_MBMS_MAX (LTE_maxSessionPerPMCH*LTE_maxServiceCount)
-
-#define NB_RAB_MAX     LTE_maxDRB       /* was 8, now 11 */
-#define RAB_SHIFT1     9
-#define RAB_SHIFT2     3
-//#define RAB_OFFSET     0x0007
-#define RAB_OFFSET     0x000F
-#define RAB_OFFSET1    0x7E00
-#define RAB_OFFSET2    0x01F8
-#define DIR_OFFSET     0x8000
-#define DIR_SHIFT      15
-#define CH_OFFSET      0x0004
-#define CH_SHIFT       2
-
-// RLC Entity
-#define RLC_TX_MAXSIZE       10000000
-#define RLC_RX_MAXSIZE       10000000
-
-// RLC_AM_SEND_MRW
-#        define SEND_MRW_OFF    15
-#        define SEND_MRW_ON     240
-
-// RLC_SEGMENTATION_INDICATION
-#        define SEGMENTATION_NOT_ALLOWED  0
-#        define SEGMENTATION_ALLOWED      1
-
-// RLC_DELIVERY_OF_ERRONEOUS_SDU
-#        define DELIVERY_OF_ERRONEOUS_SDU_NO           0
-#        define DELIVERY_OF_ERRONEOUS_SDU_YES          1
-#        define DELIVERY_OF_ERRONEOUS_SDU_NO_DETECT    2
-
-
-// CBA constant
-#define NUM_MAX_CBA_GROUP 4
-
-#ifndef __cplusplus
-  #ifndef NULL
-    #define NULL 0
-  #endif
-  #ifndef null
-    #define null 0
-  #endif
-#endif
-
-#define  UNUSED_PARAM_MBMS_SESSION_ID  0
-#define  UNUSED_PARAM_MBMS_SERVICE_ID  0
-
-#define printk printf
-
-#define UNUSED_VARIABLE(vARIABLE)   (void)(vARIABLE)
-
-#endif /* __PLATFORM_CONSTANTS_H__ */
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index 8aebd0374b22194316d5f893e04109e0e8578e5e..3c2c91c2d8048a0cc5a0e517e935410f32055c40 100644
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -224,9 +224,9 @@ typedef struct protocol_ctxt_s {
 // warning time hardcoded
 #define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame*10+(CtXt_h)->subframe)
 
-#define UE_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD + NB_eNB_INST
+#define UE_MODULE_ID_TO_INSTANCE(mODULE_iD) mODULE_iD + RC.nb_inst
 #define ENB_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD
-#define UE_INSTANCE_TO_MODULE_ID( iNSTANCE ) iNSTANCE - NB_eNB_INST
+#define UE_INSTANCE_TO_MODULE_ID(iNSTANCE) iNSTANCE - RC.nb_inst
 #define ENB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE
 
 //NR
diff --git a/openair2/COMMON/rrm_constants.h b/openair2/COMMON/rrm_constants.h
index 5da8f773c339d582854d8d5293774f732b3d0ffb..1f84637d788f217daf4855723c3a7965ff026fcb 100644
--- a/openair2/COMMON/rrm_constants.h
+++ b/openair2/COMMON/rrm_constants.h
@@ -31,7 +31,7 @@
  ***************************************************************************/
 #    ifndef __RRM_CONSTANTS_H__
 #        define __RRM_CONSTANTS_H__
-#        include "platform_constants.h"
+#include "common/platform_constants.h"
 
 /*#################################################
   CONSTANTS FOR L1/L2/L3 LAYERS
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 54fc1bf6be14d8c7d3027ebf9c81cdbbedd473e4..98ddaebfdcc3ec19d0cb73caa71085c0e82b34ad 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -49,7 +49,6 @@
 #   define X2AP_ENB_REGISTER_RETRY_DELAY   10
 
 #include "openair1/PHY/INIT/phy_init.h"
-extern unsigned char NB_eNB_INST;
 
 extern RAN_CONTEXT_t RC;
 
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index 0ef31d42e6d01929238f4eb75f4c69bed8d7466c..c7f65f1d0e8c12bdea31bca22081964851c1d581 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -36,7 +36,7 @@
 
 #include "commonDef.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
 #include "f1ap_messages_types.h"
diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h
index 889a8dfb7b020ae5ab0e53df4b51f18909652858..b2a9ece078ebbfc431e7a53ccb989e04f5ee654b 100644
--- a/openair2/GNB_APP/gnb_config.h
+++ b/openair2/GNB_APP/gnb_config.h
@@ -36,7 +36,7 @@
 
 #include "commonDef.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
 #include "ngap_messages_types.h"
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index dfc1d28daa60cb6b74e721595567bc48aad8a956..732ebd4d4a8f7574f09a172a866735b19fd98390 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -29,7 +29,7 @@
  */
 
 #include "COMMON/platform_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "LTE_SystemInformationBlockType2.h"
 //#include "RadioResourceConfigCommonSIB.h"
 #include "LTE_RadioResourceConfigDedicated.h"
@@ -58,6 +58,7 @@ extern int l2_init_eNB(void);
 extern void mac_top_init_eNB(void);
 extern void mac_init_cell_params(int Mod_idP,int CC_idP);
 
+SCHEDULER_MODES global_scheduler_mode;
 typedef struct eutra_bandentry_s {
   int16_t band;
   uint32_t ul_min;
diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c
index 3cfc725fdb3f4d6e249740deccff972d0908bad9..4ede02d330c14b7175267ffbc7a6d8bc2a1a8abd 100644
--- a/openair2/LAYER2/MAC/config_ue.c
+++ b/openair2/LAYER2/MAC/config_ue.c
@@ -33,7 +33,7 @@
 
 
 #include "COMMON/platform_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 #include "SCHED_UE/sched_UE.h"
 #include "LTE_SystemInformationBlockType2.h"
diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h
index abe780741c05c225f30758cfc5b622644e6da58d..a0edf9374e1da28c610a66b87bfc2f4bbdae4f08 100644
--- a/openair2/LAYER2/MAC/defs_NB_IoT.h
+++ b/openair2/LAYER2/MAC/defs_NB_IoT.h
@@ -12,8 +12,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-//#include "COMMON/openair_defs.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "COMMON/mac_rrc_primitives.h"
 #include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
 //#include "PHY/defs.h"
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 08986221154e0bc82053d9cfe958be90778dc75e..2cd1a4167f96c59e77f3448bd55d30a72a159abe 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -58,6 +58,7 @@
 #include <dlfcn.h>
 
 #include "T.h"
+#include "openair2/LAYER2/MAC/mac_extern.h"
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 //#define DEBUG_eNB_SCHEDULER 1
@@ -65,26 +66,7 @@
 #include "common/ran_context.h"
 extern RAN_CONTEXT_t RC;
 
-
-//------------------------------------------------------------------------------
-void
-add_ue_dlsch_info(module_id_t module_idP,
-                  int CC_id,
-                  int UE_id,
-                  sub_frame_t subframeP,
-                  UE_DLSCH_STATUS status,
-                  rnti_t rnti)
-//------------------------------------------------------------------------------
-{
-  eNB_DLSCH_INFO *info = &eNB_dlsch_info[module_idP][CC_id][UE_id];
-  // LOG_D(MAC, "%s(module_idP:%d, CC_id:%d, UE_id:%d, subframeP:%d, status:%d) serving_num:%d rnti:%x\n", __FUNCTION__, module_idP, CC_id, UE_id, subframeP, status, eNB_dlsch_info[module_idP][CC_id][UE_id].serving_num, UE_RNTI(module_idP,UE_id));
-  info->rnti = rnti;
-  //  info->weight = weight;
-  info->subframe = subframeP;
-  info->status = status;
-  info->serving_num++;
-  return;
-}
+mac_rlc_am_muilist_t rlc_am_mui;
 
 //------------------------------------------------------------------------------
 int
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index 9836b643d4109b956b53fa2cc8769b11bf6afb46..1cfc8ee838ed8fc150199665cfd43e6f47f2fcc7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -295,13 +295,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
             // update UL DAI after DLSCH scheduling
             set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
           }
-
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_NONE,
-                            rnti);
+          eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_NONE;
           end_flag[CC_id] = 1;
           break;
         }
@@ -423,13 +417,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
             // update UL DAI after DLSCH scheduling
             set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
           }
-
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_NONE,
-                            rnti);
+          eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_NONE;
           end_flag[CC_id] = 1;
           break;
         }
@@ -551,13 +539,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
             // update UL DAI after DLSCH scheduling
             set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
           }
-
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_NONE,
-                            rnti);
+          eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_NONE;
           end_flag[CC_id] = 1;
           break;
         }
@@ -1204,7 +1186,6 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
     }
   }
 
-  //weight = get_ue_weight(module_idP,UE_id);
   //    aggregation = 2;
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth);
@@ -1503,13 +1484,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
                       frameP, subframeP, UE_id, rnti);
               }
           }
-
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_SCHEDULED,
-                            rnti);
+          eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_SCHEDULED;
           UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[round]++;
           UE_info->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1;
           UE_info->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb;
@@ -1943,12 +1918,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
           T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
             T_INT(harq_pid), T_BUFFER(UE_info->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS));
           UE_info->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
-          add_ue_dlsch_info(module_idP,
-                            CC_id,
-                            UE_id,
-                            subframeP,
-                            S_DL_SCHEDULED,
-                            rnti);
+          eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_SCHEDULED;
           // store stats
           eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total;
           eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1;
@@ -2162,7 +2132,7 @@ fill_DLSCH_dci_fairRR(
 
       if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) {
         // clear scheduling flag
-        eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING;
+        eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_NONE;
         rnti = UE_RNTI(module_idP,UE_id);
         harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP);
         nb_rb = UE_info->UE_template[CC_id][UE_id].nb_rb[harq_pid];
@@ -3351,12 +3321,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t   module_idP,
         uint16_t ul_sched_frame = sched_frame;
         uint16_t ul_sched_subframeP = sched_subframeP;
         add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2);
-        ul_req->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP;
-        add_ue_ulsch_info(module_idP,
-                          CC_id,
-                          UE_id,
-                          subframeP,
-                          S_UL_SCHEDULED);
+        ul_req->sfn_sf = ul_sched_frame << 4 | ul_sched_subframeP;
         LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id);
         // increment first rb for next UE allocation
         first_rb[CC_id]+=rb_table[rb_table_index];
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
index 1e595f11b52803d93a3fed7a7c5d09fb722e2768..9ade5eb8b2f5973395f05a447eedea7f5545da58 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c
@@ -324,11 +324,6 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s
 
     ul_req->number_of_pdus = 1;
     mac->ul_handle++;
-    add_ue_ulsch_info(module_idP,
-                      CC_id,
-                      UE_id,
-                      subframeP,
-                      S_UL_SCHEDULED);
     // increment first rb for next UE allocation
     first_rb[CC_id]+= nb_rb;
   } // loop of CC_id
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 58abbd7a478010ea71fec429026637a9a0238577..b896e4777aa99acc409dfe1e19ec3887d58d0b87 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -58,10 +58,36 @@ extern uint16_t frame_cnt;
 
 #include "common/ran_context.h"
 #include "SCHED/sched_common.h"
+#include "openair2/LAYER2/MAC/mac_extern.h"
+/*
+ * If the CQI is low, then scheduler will use a higher aggregation level and lower aggregation level otherwise
+ * this is also dependent to transmission mode, where an offset could be defined
+ */
+// the follwoing three tables are calibrated for TXMODE 1 and 2
+static const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 37 bits
+    //{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 43
+    {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0} // 20_DCI0_CRC_SIZE = 44
+};
 
-extern RAN_CONTEXT_t RC;
+static const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size < 38 bits
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE  < 43
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE  < 47
+    {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0} // 20_DCI0_CRC_SIZE  < 55
+};
 
+static const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
+    {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 47 bits
+    {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 55
+    {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 59
+    {3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0} // 20_DCI0_CRC_SIZE = 64
+};
 
+extern RAN_CONTEXT_t RC;
+eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
 //------------------------------------------------------------------------------
 int
 choose(int n,
@@ -1940,8 +1966,6 @@ narrowband_to_first_rb(COMMON_channels_t *cc,
 
   return 0;
 }
-
-//------------------------------------------------------------------------------
 void
 init_ue_sched_info(void)
 //------------------------------------------------------------------------------
@@ -1951,15 +1975,7 @@ init_ue_sched_info(void)
   for (i = 0; i < NUMBER_OF_eNB_MAX; i++) {
     for (k = 0; k < MAX_NUM_CCs; k++) {
       for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
-        // init DL
-        eNB_dlsch_info[i][k][j].weight = 0;
-        eNB_dlsch_info[i][k][j].subframe = 0;
-        eNB_dlsch_info[i][k][j].serving_num = 0;
         eNB_dlsch_info[i][k][j].status = S_DL_NONE;
-        // init UL
-        eNB_ulsch_info[i][k][j].subframe = 0;
-        eNB_ulsch_info[i][k][j].serving_num = 0;
-        eNB_ulsch_info[i][k][j].status = S_UL_NONE;
       }
     }
   }
@@ -1967,16 +1983,6 @@ init_ue_sched_info(void)
   return;
 }
 
-//------------------------------------------------------------------------------
-unsigned char
-get_ue_weight(module_id_t module_idP,
-              int CC_idP,
-              int ue_idP)
-//------------------------------------------------------------------------------
-{
-  return (eNB_dlsch_info[module_idP][CC_idP][ue_idP].weight);
-}
-
 //------------------------------------------------------------------------------
 int
 find_UE_id(module_id_t mod_idP,
@@ -2239,9 +2245,7 @@ add_new_ue(module_id_t mod_idP,
       UE_info->UE_sched_ctrl[UE_id].round[cc_idP][j] = 8;
       UE_info->UE_sched_ctrl[UE_id].round_UL[cc_idP][j] = 0;
     }
-
-    eNB_ulsch_info[mod_idP][cc_idP][UE_id].status = S_UL_WAITING;
-    eNB_dlsch_info[mod_idP][cc_idP][UE_id].status = S_DL_WAITING;
+    eNB_dlsch_info[mod_idP][cc_idP][UE_id].status = S_DL_NONE;
     LOG_D(MAC, "[eNB %d] Add UE_id %d on Primary CC_id %d: rnti %x\n",
           mod_idP,
           UE_id,
@@ -2317,13 +2321,7 @@ rrc_mac_remove_ue(module_id_t mod_idP,
   ue_stats->total_pdu_bytes_rx = 0;
   ue_stats->total_num_pdus_rx = 0;
   ue_stats->total_num_errors_rx = 0;
-  eNB_ulsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
-  eNB_ulsch_info[mod_idP][pCC_id][UE_id].status = S_UL_NONE;
-  eNB_ulsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
-  eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
   eNB_dlsch_info[mod_idP][pCC_id][UE_id].status = S_DL_NONE;
-  eNB_dlsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
-
   // check if this has an RA process active
   if (find_RA_id(mod_idP,
                  pCC_id,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index efef339702d90f0e74b4959debf87b2f51b8e85b..48324569155c606326cb4b95ee81243fa07f7782 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -1063,24 +1063,6 @@ bytes_to_bsr_index(int32_t nbytes)
   return (i - 1);
 }
 
-//-----------------------------------------------------------------------------
-/*
- * Add ue info in eNB_ulsch_info[module_idP][CC_id][UE_id] struct
- */
-void
-add_ue_ulsch_info(module_id_t module_idP,
-                  int CC_id,
-                  int UE_id,
-                  sub_frame_t subframeP,
-                  UE_ULSCH_STATUS status)
-//-----------------------------------------------------------------------------
-{
-  eNB_ulsch_info[module_idP][CC_id][UE_id].rnti     = UE_RNTI(module_idP, UE_id);
-  eNB_ulsch_info[module_idP][CC_id][UE_id].subframe = subframeP;
-  eNB_ulsch_info[module_idP][CC_id][UE_id].status   = status;
-  eNB_ulsch_info[module_idP][CC_id][UE_id].serving_num++;
-}
-
 //-----------------------------------------------------------------------------
 /*
  * Parse MAC header from ULSCH
@@ -1786,7 +1768,6 @@ schedule_ulsch_rnti(module_id_t   module_idP,
       ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
       mac->ul_handle++;
       ul_req_tmp->sfn_sf = sched_frame << 4 | sched_subframeP;
-      add_ue_ulsch_info(module_idP, CC_id, UE_id, subframeP, S_UL_SCHEDULED);
       LOG_D(MAC,
             "[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for "
             "next UE_id %d, format 0\n",
@@ -2284,11 +2265,6 @@ void schedule_ulsch_rnti_emtc(module_id_t   module_idP,
                                                  (frameP * 10) + subframeP);
             ul_req_tmp->number_of_pdus++;
             eNB->ul_handle++;
-            add_ue_ulsch_info(module_idP,
-                              CC_id,
-                              UE_id,
-                              subframeP,
-                              S_UL_SCHEDULED);
             LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n",
                   module_idP,
                   CC_id,
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index fe2f877fb3ac7523c9307b9ed3d67dd072db98b5..c958d7cf859b52b2e14e71198ca6f9948b706ad5 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -43,7 +43,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "LTE_BCCH-BCH-Message.h"
 #include "LTE_RadioResourceConfigCommon.h"
 #include "LTE_RadioResourceConfigCommonSIB.h"
@@ -504,66 +504,18 @@ typedef struct {
 } __attribute__ ((__packed__)) ULDCH_PDU;
 
 /*!\brief RA process state*/
-typedef enum {
-  IDLE = 0,
-  MSG2,
-  WAITMSG3,
-  MSG4,
-  WAITMSG4ACK,
-  MSGCRNTI,
-  MSGCRNTI_ACK
-} RA_state;
-
-/*!\brief  UE ULSCH scheduling states*/
-typedef enum {
-  S_UL_NONE = 0,
-  S_UL_WAITING,
-  S_UL_SCHEDULED,
-  S_UL_BUFFERED,
-  S_UL_NUM_STATUS
-} UE_ULSCH_STATUS;
-
+typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } RA_state;
 /*!\brief  UE DLSCH scheduling states*/
-typedef enum {
-  S_DL_NONE = 0,
-  S_DL_WAITING,
-  S_DL_SCHEDULED,
-  S_DL_BUFFERED,
-  S_DL_NUM_STATUS
-} UE_DLSCH_STATUS;
-
-/*!\brief  scheduling policy for the contention-based access */
-typedef enum {
-  CBA_ES = 0,     /// equal share of RB among groups w
-  CBA_ES_S,     /// equal share of RB among groups with small allocation
-  CBA_PF,     /// proportional fair (kind of)
-  CBA_PF_S,     /// proportional fair (kind of) with small RB allocation
-  CBA_RS      /// random allocation
-} CBA_POLICY;
-
+typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS;
 /*!\brief  scheduler mode */
 typedef enum {
-  SCHED_MODE_DEFAULT = 0,     /// default cheduler
-  SCHED_MODE_FAIR_RR      /// fair raund robin
+  SCHED_MODE_DEFAULT = 0, /// default cheduler
+  SCHED_MODE_FAIR_RR /// fair raund robin
 } SCHEDULER_MODES;
-
-/*! \brief temporary struct for ULSCH sched */
-typedef struct {
-  rnti_t rnti;
-  uint16_t subframe;
-  uint16_t serving_num;
-  UE_ULSCH_STATUS status;
-} eNB_ULSCH_INFO;
-
 /*! \brief temp struct for DLSCH sched */
 typedef struct {
-  rnti_t rnti;
-  uint16_t weight;
-  uint16_t subframe;
-  uint16_t serving_num;
   UE_DLSCH_STATUS status;
 } eNB_DLSCH_INFO;
-
 /*! \brief eNB overall statistics */
 typedef struct {
   /// num BCCH PDU per CC
@@ -1142,16 +1094,6 @@ typedef struct {
   int8_t   crnti_harq_pid;
 } RA_t;
 
-
-/*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */
-typedef struct {
-  uint8_t sbmap[13];  //13 = number of SB MAX for 100 PRB
-  uint8_t periodicity;
-  uint8_t first_subframe;
-  uint8_t sb_size;
-  uint8_t nb_active_sb;
-} SBMAP_CONF;
-
 /*! \brief UE_list_t is a "list" of users within UE_info_t. Especial useful in
  * the scheduler and to keep "classes" of users. */
 typedef struct {
@@ -1403,9 +1345,6 @@ typedef struct eNB_MAC_INST_s {
   /// UL handle
   uint32_t ul_handle;
   UE_info_t UE_info;
-
-  ///subband bitmap configuration
-  SBMAP_CONF sbmap_conf;
   /// CCE table used to build DCI scheduling information
   int CCE_table[NFAPI_CC_MAX][800];
   ///  active flag for Other lcid
@@ -1724,11 +1663,6 @@ typedef struct {
   eth_params_t         eth_params_n;
 
 } UE_MAC_INST;
-/*! \brief ID of the neighboring cells used for HO*/
-typedef struct {
-  uint16_t cell_ids[6];
-  uint8_t n_adj_cells;
-} neigh_cell_id_t;
 
 typedef struct {
   volatile uint8_t flag;
diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h
index 212422898be33c72f7cf149e5259ef5f12cad99d..3d6bba1550a671a8e8cc8e2490c4c92dd4fcfc63 100644
--- a/openair2/LAYER2/MAC/mac_extern.h
+++ b/openair2/LAYER2/MAC/mac_extern.h
@@ -36,33 +36,12 @@
 #include "mac.h"
 #include "RRC/LTE/rrc_defs.h"
 
-extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
-//extern uint32_t EBSR_Level[63];
-extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
-//extern uint32_t Extended_BSR_TABLE[63];  ----currently not used 
-
-extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-
-extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-
-extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-
 extern UE_RRC_INST *UE_rrc_inst;
 extern UE_MAC_INST *UE_mac_inst;
-
-extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB];	// eNBxUE = 8x8
-extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB];	// eNBxUE = 8x8
-
-extern unsigned char NB_INST;
-extern unsigned char NB_eNB_INST;
-extern uint16_t NB_UE_INST;
-extern uint16_t NB_THREAD_INST;
-extern unsigned char NB_RN_INST;
+extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
+extern int NB_UE_INST;
 
 extern const int cqi_to_mcs[16];
-
-extern uint32_t RRC_CONNECTION_FLAG;
-
 extern uint8_t rb_table[34];
 extern rb_id_t mbms_rab_id;
 
@@ -81,4 +60,10 @@ extern SCHEDULER_MODES global_scheduler_mode;
 #include "common/ran_context.h"
 extern RAN_CONTEXT_t RC;
 extern rb_id_t mbms_rab_id;
+
+static const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = {0,     10,    12,    14,    17,    19,    22,    26,    31,    36,    42,    49,    57,     67,     78,     91,
+                                                   105,   125,   146,   171,   200,   234,   274,   321,   376,   440,   515,   603,   706,    826,    967,    1132,
+                                                   1326,  1552,  1817,  2127,  2490,  2915,  3413,  3995,  4677,  5467,  6411,  7505,  8787,   10287,  12043,  14099,
+                                                   16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255, 68201, 79846, 93479, 109439, 128125, 150000, 300000};
+
 #endif //DEF_H
diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h
index 6e9d36e242626fa07361d4536bd307cd53197c18..af94ef3ae04872512a757cc4f660c24f8b5b9535 100644
--- a/openair2/LAYER2/MAC/mac_proto.h
+++ b/openair2/LAYER2/MAC/mac_proto.h
@@ -212,11 +212,6 @@ void mac_switch_node_function(module_id_t module_idP);
 
 int mac_init_global_param(void);
 
-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 clear_nfapi_information(eNB_MAC_INST *eNB, int CC_idP,
                              frame_t frameP, sub_frame_t subframeP);
 
@@ -391,10 +386,6 @@ MCH_PDU *get_mch_sdu(module_id_t Mod_id, int CC_id, frame_t frame,
 void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index);
 void ue_init_mac(module_id_t module_idP);
 void init_ue_sched_info(void);
-void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id,
-                       sub_frame_t subframe, UE_ULSCH_STATUS status);
-void add_ue_dlsch_info(module_id_t module_idP, int CC_id, int UE_id,
-                       sub_frame_t subframe, UE_DLSCH_STATUS status, rnti_t rnti);
 int find_UE_id(module_id_t module_idP, rnti_t rnti);
 int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
 rnti_t UE_RNTI(module_id_t module_idP, int UE_id);
@@ -488,8 +479,6 @@ uint32_t req_new_ulsch(module_id_t module_idP);
 uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
                    uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe);
 
-uint8_t get_ue_weight(module_id_t module_idP, int CC_id, int UE_id);
-
 // UE functions
 void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
                          uint16_t CH_index);
diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h
deleted file mode 100644
index 3b51820171e39ba2c3ec03ef26ab6289c60caa9c..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/mac_vars.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file vars.h
-* \brief mac vars
-* \author  Navid Nikaein and Raymond Knopp
-* \date 2010 - 2014
-* \version 1.0
-* \email navid.nikaein@eurecom.fr
-* @ingroup _mac
-*/
-
-
-#ifndef __MAC_VARS_H__
-#define __MAC_VARS_H__
-#include "PHY/defs_common.h"
-#include "mac.h"
-#include "COMMON/mac_rrc_primitives.h"
-
-const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = {
-  0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91,
-  105, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826,
-  967, 1132,
-  1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995, 4677, 5467, 6411, 7505,
-  8787, 10287, 12043, 14099,
-  16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255, 68201,
-  79846, 93479, 109439, 128125, 150000, 300000
-};
-
-// extended bsr table--currently not used
-const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {
-  0, 10, 13, 16, 19, 23, 29, 35, 43, 53, 65, 80, 98, 120, 147,
-  181, 223, 274, 337, 414, 509, 625, 769, 945, 1162, 1429,
-  1757, 2161, 2657, 3267, 4017, 4940, 6074, 7469, 9185,
-  11294, 13888, 17077, 20999, 25822, 31752, 39045, 48012,
-  59039, 72598, 89272, 109774, 134986, 165989, 204111,
-  250990, 308634, 379519, 466683, 573866, 705666, 867737,
-  1067031, 1312097, 1613447, 1984009, 2439678, 3000000,
-  6000000
-};
-
-//#define MAX_SIZE_OF_AGG3   576
-//#define MAX_SIZE_OF_AGG2   288
-//#define MAX_SIZE_OF_AGG1   144
-//#define MAX_SIZE_OF_AGG0   72
-
-/*
- * If the CQI is low, then scheduler will use a higher aggregation level and lower aggregation level otherwise
- * this is also dependent to transmission mode, where an offset could be defined
- */
-// the follwoing three tables are calibrated for TXMODE 1 and 2
-const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 37 bits
-  //{3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 41
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 43
-  {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}  // 20_DCI0_CRC_SIZE = 44
-};
-
-const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size < 38 bits
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE  < 43
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE  < 47
-  {3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0}  // 20_DCI0_CRC_SIZE  < 55
-};
-
-const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
-  {3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, // 1.4_DCI0_CRC_Size= 47 bits
-  {3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, // 5_DCI0_CRC_SIZE = 55
-  {3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0}, // 10_DCI0_CRC_SIZE = 59
-  {3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0}  // 20_DCI0_CRC_SIZE = 64
-};
-
-//uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181};
-
-
-uint32_t RRC_CONNECTION_FLAG;
-
-UE_MAC_INST *UE_mac_inst = NULL;  //[NB_MODULE_MAX];
-MAC_RLC_XFACE *Mac_rlc_xface;
-
-/// Primary component carrier index of eNB
-int pCC_id[NUMBER_OF_eNB_MAX];
-
-
-eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
-eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8
-
-
-  unsigned char NB_eNB_INST = 0;
-  uint16_t NB_UE_INST = 0;
-  uint16_t NB_THREAD_INST = 0;
-  unsigned char NB_RN_INST = 0;
-  unsigned char NB_INST = 0;
-
-
-DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
-
-DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A;
-DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu;
-DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
-
-DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
-DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
-DCI1C_5MHz_t MCCH_alloc_pdu;
-
-DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
-
-DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
-DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd;
-DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd;
-
-DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd;
-DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd;
-
-DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
-DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
-
-DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
-
-mac_rlc_am_muilist_t rlc_am_mui;
-SCHEDULER_MODES global_scheduler_mode;
-#endif
diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c
index fa647454ba644df40df85a03dc76cbc768ecf1c6..4c46238b6c042c738d2aff8db8dd9ffb831621b7 100644
--- a/openair2/LAYER2/MAC/main.c
+++ b/openair2/LAYER2/MAC/main.c
@@ -249,20 +249,6 @@ int rlcmac_init_global_param(void)
     return 0;
 }
 
-
-void mac_top_cleanup(void)
-{
-
-    if (NB_UE_INST > 0) {
-	free(UE_mac_inst);
-    }
-
-    if (RC.nb_macrlc_inst > 0) {
-	free(RC.mac);
-    }
-
-}
-
 int l2_init_eNB(void)
 {
 
diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c
index 5ea2d26abdb063468e939fe1987806be019e0872..e67d85dd36bea158c67ac021e93e24cf415d03b9 100644
--- a/openair2/LAYER2/MAC/main_ue.c
+++ b/openair2/LAYER2/MAC/main_ue.c
@@ -59,13 +59,6 @@ void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char e
   }
 }
 
-void
-mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
-                       uint16_t eNB_index) {
-  //  Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
-}
-
-
 int
 mac_top_init_ue(int eMBMS_active, char *uecap_xer,
                 uint8_t cba_group_active, uint8_t HO_active) {
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
index 3648ad2c91a0ca20027b0e23b26dfa274cfe05d3..1b47ea6ede6c9f996c2c04db221f7e57ad6d82b1 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
@@ -41,24 +41,6 @@ extern const uint8_t nr_slots_per_frame[5];
 
 extern dci_pdu_rel15_t *def_dci_pdu_rel15;
 
-/* extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
-extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
-extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
-extern UE_RRC_INST *UE_rrc_inst;
-extern const int cqi_to_mcs[16];
-extern uint32_t RRC_CONNECTION_FLAG;
-extern uint8_t rb_table[34];
-extern mac_rlc_am_muilist_t rlc_am_mui;
-extern SCHEDULER_MODES global_scheduler_mode;
-extern unsigned char NB_UE_INST;*/
-
-
-extern unsigned char NB_INST;
-extern unsigned char NB_eNB_INST;
-extern unsigned char NB_RN_INST;
-
 /* Scheduler */
 extern RAN_CONTEXT_t RC;
 extern uint8_t nfapi_mode;
@@ -67,7 +49,6 @@ extern SCHEDULER_MODES global_scheduler_mode;
 
 /*#if defined(PRE_SCD_THREAD)
 extern const int cqi_to_mcs[16];
-extern uint32_t RRC_CONNECTION_FLAG;
 extern uint8_t rb_table[34];
 
 #if defined(PRE_SCD_THREAD)
diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c
index e1ec0f6bafadf4440b8c1584dafcc64ee30a697b..40de95be60d72dfc9777e36cdfece0da233382bb 100644
--- a/openair2/LAYER2/NR_MAC_gNB/config.c
+++ b/openair2/LAYER2/NR_MAC_gNB/config.c
@@ -31,7 +31,7 @@
  */
 
 #include "COMMON/platform_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "common/ran_context.h"
 #include "common/utils/nr/nr_common.h"
 #include "common/utils/LOG/log.h"
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
index 25be7f7c1726b96761f09480cf96f9fa790bf7d9..37435664dad91cac4091232a41a293bc3e40917f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
@@ -44,7 +44,7 @@
 
 /* Commmon */
 #include "radio/COMMON/common_lib.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "common/ran_context.h"
 #include "collection/linear_alloc.h"
 
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index e39e1dc090d89b15bdd9e1bc3011950d0f4dc738..03ff38611a9f8f05b8cb4d9eb9f15549f44e8230 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -45,7 +45,7 @@
 #include "otg_rx.h"
 #include "common/utils/LOG/log.h"
 #include <inttypes.h>
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "common/ngran_types.h"
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 898bf984de4ede51bd630e450fd3fd8e8b158678..944e641358d36c8997f21111a541808cb30df325 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -36,7 +36,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 #include "RRC/LTE/rrc_defs.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "COMMON/platform_types.h"
 #include "LTE_DRB-ToAddMod.h"
 #include "LTE_DRB-ToAddModList.h"
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index d6e022f4f195c9912dcdf22e69fde35a754c8bd3..a909343965937a2d9fd0963f7edb9475b9f0e6a6 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -57,7 +57,7 @@ extern int otg_enabled;
 #include "UTIL/OTG/otg_tx.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "pdcp.h"
 
 #include "assertions.h"
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
index 77d3cf3857a3d32f2616ea8ae95709ac4e308f6d..675fbd8a57e450f95b8ed5025271c2fa0715fb20 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c
@@ -28,7 +28,7 @@
 
 #include "common/utils/LOG/log.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "pdcp.h"
 #include "pdcp_primitives.h"
 
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
index ddc7bf85e851f14fac0bdcac0c8279d0c391870d..aed00e578a3bccdecd98ac0200f9c309c8ff9d6b 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
@@ -23,7 +23,7 @@
 #define RLC_AM_C 1
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 
 #include "assertions.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
index 95c47943a49abcfc0501aa0e306178e4cbd1538c..e6bcd0f4ba6c60a38e1e9f3996d0d25fdecc8e86 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
@@ -38,7 +38,7 @@
 //-----------------------------------------------------------------------------
 #        include <pthread.h>
 #        include "platform_types.h"
-#        include "platform_constants.h"
+#include "common/platform_constants.h"
 #        include "list.h"
 #        include "rlc_primitives.h"
 #        include "rlc_def_lte.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
index 9de54cd3d5becdd81a4f950159e696ed08ff4e38..df140f03266802e49be14ed19122630681ac8c90 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
@@ -39,7 +39,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //#include "PHY/defs.h"
 
 
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
index 18e423312cba1a53f40e1198eb2486ebacecfc54..f86b1810cab4c15fb515e90a5228560372f07aef 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
@@ -39,7 +39,7 @@
 #    include "UTIL/MEM/mem_block.h"
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //#include "PHY/defs.h"
 
 //-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
index a84b25c8e5675c87807add446945c93a250bafd0..861e15212383e5a9382e285061517713a11db1c0 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
@@ -39,7 +39,7 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //#include "PHY/defs.h"
 
 //-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
index 147fd44d07e0cb0f55af32d92eca4b8011aeda2e..cc2e3b9c1b9ba5eb7270e5e144c1d33c92d3b8e3 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
@@ -32,7 +32,7 @@
 #        define __RLC_AM_STRUCTS_H__
 
 #        include "platform_types.h"
-#        include "platform_constants.h"
+#include "common/platform_constants.h"
 #        include "list.h"
 #        include "mem_block.h"
 #        include "rlc_am_constants.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
index 7aead2f30a46aa64a9e79207db673ed9af911aed..7e3e120477e36249654e0717f8661058b9b8d4c5 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
@@ -24,7 +24,7 @@
 //-----------------------------------------------------------------------------
 //#include "rtos_header.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #include "rlc_am.h"
 #include "LAYER2/MAC/mac_extern.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
index d161d29a65db23457fad697b41cf400ed3717a3d..e46f9c5377c0bc0319f82a4b1af46c22605506f0 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
@@ -23,7 +23,7 @@
 #define RLC_AM_TIMER_POLL_REORDERING_C 1
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #include "rlc_am.h"
 # include "LAYER2/MAC/mac_extern.h"
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
index aae7465bcf1840f8d22de2d1b20a89b05bb56e5c..7359b6a07f85506b6dc1a23421e6b1379b892c2a 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
@@ -23,7 +23,7 @@
 #define RLC_AM_TIMER_STATUS_PROHIBIT_C 1
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #include "rlc_am.h"
 #include "LAYER2/MAC/mac_extern.h"
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
index f079696aa911d8491cb6b0bf1e9db3e0c4d58763..d699d1d6a4a33bb29774ec1954f197cbb74944a4 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
@@ -23,7 +23,7 @@
 #define RLC_TM_C 1
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #include "rlc_tm.h"
 #include "mac_primitives.h"
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
index 3c2f1804bec6eff71530fc36032252d772b45f24..b6795d4488b19a11eb7ffa72c7d35984ec972f66 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
@@ -32,7 +32,7 @@
 #        define __RLC_TM_ENTITY_H__
 //-----------------------------------------------------------------------------
 #        include "platform_types.h"
-#        include "platform_constants.h"
+#include "common/platform_constants.h"
 #        include "rlc_tm_structs.h"
 #        include "rlc_def.h"
 //-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
index 1d40b12cc8ebc5c8e88b648560ec84b2f88fdf49..a77280ffd225808a7407aa620bbfbc0afda5e4b1 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
@@ -24,7 +24,7 @@
 //-----------------------------------------------------------------------------
 //#include "rtos_header.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #if ENABLE_ITTI
   #include "intertask_interface.h"
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
index 7bfa3d60ffe6f8c4ba104c9357f9689dd22d21de..34ead658224749ef75e329b5baa11fba4bbe155b 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
@@ -33,7 +33,7 @@
 
 #        include <pthread.h>
 #        include "platform_types.h"
-#        include "platform_constants.h"
+#include "common/platform_constants.h"
 #        include "list.h"
 #        include "rlc_primitives.h"
 #        include "rlc_def.h"
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
index 7b77152e3299d1a5c0df0bb1cfab102d31db788c..5252a8a1212198f3f1471a80acdf0d2a232e9175 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
@@ -23,7 +23,7 @@
 #define RLC_UM_SEGMENT_C 1
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 #include <assert.h>
 #include "assertions.h"
diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h
index 1e17ff96bfcfa2a8060040dba9465b4a23163f2b..561a664d85056e772906434b5ff95721d61c0c05 100644
--- a/openair2/LAYER2/RLC/rlc.h
+++ b/openair2/LAYER2/RLC/rlc.h
@@ -36,7 +36,7 @@
 #    define __RLC_H__
 
 #    include "platform_types.h"
-#    include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #    include "hashtable.h"
 #    include "rlc_am.h"
 #    include "rlc_um.h"
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index 0e1cb89fd7145262489f9c44269f4bc2c80826ee..2e308fc0e1c775ba1a5c0976bda16348a966281c 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -37,6 +37,7 @@
 #include "hashtable.h"
 #include "assertions.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
+#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
 
 //#define DEBUG_MAC_INTERFACE 1
 
diff --git a/openair2/LAYER2/RLC/rlc_primitives.h b/openair2/LAYER2/RLC/rlc_primitives.h
index bb83852775a581618757c7e9ef7be5c72caed146..0e751855d55e47f70a9c0ba5e7bfb63827ef9394 100644
--- a/openair2/LAYER2/RLC/rlc_primitives.h
+++ b/openair2/LAYER2/RLC/rlc_primitives.h
@@ -34,7 +34,7 @@
 #    include <stdio.h>
 #    include <stdlib.h>
 #    include "platform_types.h"
-#    include "platform_constants.h"
+#include "common/platform_constants.h"
 #    include "mem_block.h"
 
 
diff --git a/openair2/MCE_APP/mce_config.h b/openair2/MCE_APP/mce_config.h
index 3078b64e49d9786cc5e10b1382a2df46a9311cd8..dbed65221ac241351f56291e64ca174bc5cb7818 100644
--- a/openair2/MCE_APP/mce_config.h
+++ b/openair2/MCE_APP/mce_config.h
@@ -36,7 +36,7 @@
 
 #include "commonDef.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "PHY/impl_defs_top.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
diff --git a/openair2/NETWORK_DRIVER/MESH/netlink.c b/openair2/NETWORK_DRIVER/MESH/netlink.c
index 4908e007580921b19e104dd2abffd1c288d19256..7c4223e4e8b4f5d40a52fb7691f3b3c62d8753bb 100644
--- a/openair2/NETWORK_DRIVER/MESH/netlink.c
+++ b/openair2/NETWORK_DRIVER/MESH/netlink.c
@@ -39,7 +39,7 @@
 
 #include "local.h"
 #include "proto_extern.h"
-//#include "platform_constants.h"
+//#include "common/platform_constants.h"
 
 //#define NETLINK_DEBUG 1
 
diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h
index dec6bf5b4e63eace65baae68de16779a21488564..1fb08d6ba8180c9e8ba9e7e7c04cedf0bed308cf 100644
--- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h
+++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h
@@ -36,7 +36,7 @@
 #include <stdint.h>
 #include "nfapi_nr_interface.h"
 #include "nfapi_nr_interface_scf.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "platform_types.h"
 
 #define MAX_NUM_DL_PDU 100
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
deleted file mode 100644
index f0c4e94c9990b5af3f631110ec21f5ab88bd951d..0000000000000000000000000000000000000000
--- a/openair2/RRC/LITE/rrc_common.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file rrc_common.c
- * \brief rrc common procedures for eNB and UE
- * \author Navid Nikaein and Raymond Knopp
- * \date 2011 - 2014
- * \version 1.0
- * \company Eurecom
- * \email:  navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
- */
-
-#include "defs.h"
-#include "extern.h"
-#include "LAYER2/MAC/extern.h"
-#include "COMMON/openair_defs.h"
-#include "COMMON/platform_types.h"
-#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-#include "LAYER2/RLC/rlc.h"
-#include "COMMON/mac_rrc_primitives.h"
-#include "UTIL/LOG/log.h"
-#include "asn1_msg.h"
-#include "pdcp.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "rrc_eNB_UE_context.h"
-#include "common/ran_context.h"
-
-#ifdef LOCALIZATION
-#include <sys/time.h>
-#endif
-
-#define DEBUG_RRC 1
-extern RAN_CONTEXT_t RC;
-extern UE_MAC_INST *UE_mac_inst;
-
-extern mui_t rrc_eNB_mui;
-
-//configure  BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
-//-----------------------------------------------------------------------------
-void
-openair_rrc_on(
-  const protocol_ctxt_t* const ctxt_pP
-)
-//-----------------------------------------------------------------------------
-{
-  unsigned short i;
-  int            CC_id;
-
-  if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
-    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
-          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-    for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
-      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
-      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
-      rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
-      RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
-    }
-  } else {
-    LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
-          PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-
-    for (i = 0; i < NB_eNB_INST; i++) {
-      LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
-            PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
-      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
-      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
-      memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
-      rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
-      UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
-    }
-  }
-}
-
-//-----------------------------------------------------------------------------
-int
-rrc_init_global_param(
-  void
-)
-//-----------------------------------------------------------------------------
-{
-
-  rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
-
-  DCCH_LCHAN_DESC.transport_block_size = 4;
-  DCCH_LCHAN_DESC.max_transport_blocks = 16;
-  DCCH_LCHAN_DESC.Delay_class = 1;
-  DTCH_DL_LCHAN_DESC.transport_block_size = 52;
-  DTCH_DL_LCHAN_DESC.max_transport_blocks = 20;
-  DTCH_DL_LCHAN_DESC.Delay_class = 1;
-  DTCH_UL_LCHAN_DESC.transport_block_size = 52;
-  DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
-  DTCH_UL_LCHAN_DESC.Delay_class = 1;
-
-  Rlc_info_um.rlc_mode = RLC_MODE_UM;
-  Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
-  Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
-  Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
-  //Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
-
-  Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
-  Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
-  Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
-  Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
-  Rlc_info_am_config.rlc.rlc_am_info.t_poll_retransmit = 15;
-  Rlc_info_am_config.rlc.rlc_am_info.t_reordering = 50;
-  Rlc_info_am_config.rlc.rlc_am_info.t_status_prohibit = 10;
-
-  return 0;
-}
-
-//-----------------------------------------------------------------------------
-void
-rrc_config_buffer(
-  SRB_INFO* Srb_info,
-  uint8_t Lchan_type,
-  uint8_t Role
-)
-//-----------------------------------------------------------------------------
-{
-
-  Srb_info->Rx_buffer.payload_size = 0;
-  Srb_info->Tx_buffer.payload_size = 0;
-}
-
-
-//-----------------------------------------------------------------------------
-void
-rrc_t310_expiration(
-  const protocol_ctxt_t* const ctxt_pP,
-  const uint8_t                 eNB_index
-)
-//-----------------------------------------------------------------------------
-{
-
-  if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
-    LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
-    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
-    UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
-    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
-    UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
-      msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
-           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
-      rrc_pdcp_config_req (ctxt_pP,
-                           SRB_FLAG_YES,
-                           CONFIG_ACTION_REMOVE,
-                           UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
-                           0);
-      rrc_rlc_config_req (ctxt_pP,
-                          SRB_FLAG_YES,
-                          MBMS_FLAG_NO,
-                          CONFIG_ACTION_REMOVE,
-                          UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
-                          Rlc_info_um);
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
-      UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
-    }
-  } else { // Restablishment procedure
-    LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-RRC_status_t
-rrc_rx_tx(
-  protocol_ctxt_t* const ctxt_pP,
-  const uint8_t      enb_indexP,
-  const int          CC_id
-)
-//-----------------------------------------------------------------------------
-{
-  //uint8_t        UE_id;
-  int32_t        current_timestamp_ms, ref_timestamp_ms;
-  struct timeval ts;
-  struct rrc_eNB_ue_context_s   *ue_context_p = NULL,*ue_to_be_removed = NULL;
-
-#ifdef LOCALIZATION
-  double                         estimated_distance;
-  protocol_ctxt_t                ctxt;
-#endif
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
-
-  if(ctxt_pP->enb_flag == ENB_FLAG_NO) {
-    // check timers
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
-        LOG_D(RRC,
-              "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
-          == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
-        // ALLOW CCCH to be used
-        UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
-        rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-        return (RRC_ConnSetup_failed);
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
-    }
-
-    if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
-          == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
-	LOG_I(RRC,"Activating T310\n");
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
-      }
-    } else { // in case we have not received SIB2 yet
-      /*      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
-
-	}*/
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-      return RRC_OK;
-    }
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
-          == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
-      }
-
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
-        LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
-      }
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt    == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
-        rrc_t310_expiration (ctxt_pP, enb_indexP);
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-	LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
-        return RRC_PHY_RESYNCH;
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
-    }
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
-      if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
-        LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
-              UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
-
-      if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
-        UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
-        UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
-        LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
-              ctxt_pP->module_id);
-        //Implement 36.331, section 5.3.5.6 here
-        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-        return(RRC_Handover_failed);
-      }
-
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
-    }
-
-    // Layer 3 filtering of RRC measurements
-    if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
-      ue_meas_filtering(ctxt_pP,enb_indexP);
-    }
-
-    ue_measurement_report_triggering(ctxt_pP,enb_indexP);
-
-    if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
-      LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
-    }
-
-    if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION)   &&
-        (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
-      UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-      return(RRC_HO_STARTED);
-    }
-
-  } else { // eNB
-    check_handovers(ctxt_pP);
-    // counetr, and get the value and aggregate
-
-
-    // check for UL failure
-    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
-      LOG_D(RRC,"SFN.SN %d.%d => release timer %d/%d\n",ctxt_pP->frame,ctxt_pP->subframe,
-	    ue_context_p->ue_context.ue_release_timer,ue_context_p->ue_context.ue_release_timer_thres);
-      if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
-	if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == true) {
-	  LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
-		ue_context_p->ue_context.rnti,
-		ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
-		ue_context_p->ue_context.ul_failure_timer);
-	}
-	else {
-	  LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
-		ue_context_p->ue_context.rnti,
-		ue_context_p->ue_context.ul_failure_timer);
-	}
-      }
-      if (ue_context_p->ue_context.ul_failure_timer>0) {
-	ue_context_p->ue_context.ul_failure_timer++;
-	if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
-	  // remove UE after 20 seconds after MAC has indicated UL failure
-	  LOG_I(RRC,"Removing UE %x instance (failure)\n",ue_context_p->ue_context.rnti);
-	  ue_to_be_removed = ue_context_p;
-	  break;
-	}
-      }
-      if (ue_context_p->ue_context.ue_release_timer>0) {
-	ue_context_p->ue_context.ue_release_timer++;
-	if (ue_context_p->ue_context.ue_release_timer >=
-	    ue_context_p->ue_context.ue_release_timer_thres) {
-	  LOG_I(RRC,"Removing UE %x instance (release timer %d)\n",ue_context_p->ue_context.rnti,ue_context_p->ue_context.ue_release_timer);
-	  ue_to_be_removed = ue_context_p;
-	  exit(-1);
-	  break;
-	}
-      }
-    }
-    if (ue_to_be_removed)
-      rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
-
-#ifdef RRC_LOCALIZATION
-
-    /* for the localization, only primary CC_id might be relevant*/
-    gettimeofday(&ts, NULL);
-    current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
-    ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
-    RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
-      ctxt = *ctxt_pP;
-      ctxt.rnti = ue_context_p->ue_context.rnti;
-      estimated_distance = rrc_get_estimated_ue_distance(
-                             &ctxt,
-                             CC_id,
-                             RC.rrc[ctxt_pP->module_id]->loc_type);
-
-      if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
-          estimated_distance != -1) {
-        LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
-              ctxt.rnti,
-              ctxt_pP->module_id,
-              current_timestamp_ms,
-              ctxt_pP->frame,
-              estimated_distance);
-        LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.StatusRrc);
-        push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
-                   estimated_distance);
-        RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
-      }
-    }
-
-#endif
-    (void)ts; /* remove gcc warning "unused variable" */
-    (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
-    (void)current_timestamp_ms; /* remove gcc warning "unused variable" */
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
-  return (RRC_OK);
-}
-
-//-----------------------------------------------------------------------------
-long
-binary_search_int(
-  int elements[],
-  long numElem,
-  int value
-)
-//-----------------------------------------------------------------------------
-{
-  long first, last, middle, search = -1;
-  first = 0;
-  last = numElem-1;
-  middle = (first+last)/2;
-
-  if(value < elements[0]) {
-    return first;
-  }
-
-  if(value > elements[last]) {
-    return last;
-  }
-
-  while (first <= last) {
-    if (elements[middle] < value) {
-      first = middle+1;
-    } else if (elements[middle] == value) {
-      search = middle+1;
-      break;
-    } else {
-      last = middle -1;
-    }
-
-    middle = (first+last)/2;
-  }
-
-  if (first > last) {
-    LOG_E(RRC,"Error in binary search!");
-  }
-
-  return search;
-}
-
-/* This is a binary search routine which operates on an array of floating
-   point numbers and returns the index of the range the value lies in
-   Used for RSRP and RSRQ measurement mapping. Can potentially be used for other things
-*/
-//-----------------------------------------------------------------------------
-long
-binary_search_float(
-  float elements[],
-  long numElem,
-  float value
-)
-//-----------------------------------------------------------------------------
-{
-  long first, last, middle;
-  first = 0;
-  last = numElem-1;
-  middle = (first+last)/2;
-
-  if(value <= elements[0]) {
-    return first;
-  }
-
-  if(value >= elements[last]) {
-    return last;
-  }
-
-  while (last - first > 1) {
-    if (elements[middle] > value) {
-      last = middle;
-    } else {
-      first = middle;
-    }
-
-    middle = (first+last)/2;
-  }
-
-  if (first < 0 || first >= numElem) {
-    LOG_E(RRC,"\n Error in binary search float!");
-  }
-
-  return first;
-}
diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c
index 71f9abc63e923a15e4070b536f9f8a1186607bd2..e7f18d355f9afd5874b0502517ff114dbddba640 100644
--- a/openair2/RRC/LTE/L2_interface_ue.c
+++ b/openair2/RRC/LTE/L2_interface_ue.c
@@ -44,7 +44,7 @@
 #include "common/utils/LOG/log.h"
 #include "rrc_eNB_UE_context.h"
 #include "pdcp.h"
-
+#include "common/ran_context.h"
 
 #include "intertask_interface.h"
 
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index ec3f42ee22583d1e6da14d2878d6d828a1570f37..8b3d4d60703be3479aba5896c25dad1116431588 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -116,9 +116,6 @@ typedef struct xer_sprint_string_s {
   size_t string_index;
 } xer_sprint_string_t;
 
-extern unsigned char NB_eNB_INST;
-
-
 extern RAN_CONTEXT_t RC;
 
 uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8};
diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h
index 8f19d62cea7cd88257adf5d59dd38e9c9edf88c3..656f5334a697029277472f033d7a48c7f9565e9b 100644
--- a/openair2/RRC/LTE/defs_NB_IoT.h
+++ b/openair2/RRC/LTE/defs_NB_IoT.h
@@ -40,7 +40,7 @@
 
 #include "collection/tree.h"
 #include "rrc_types_NB_IoT.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "COMMON/platform_types.h"
 #include "common/openairinterface5g_limits.h"
 
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 3bb86d93b5ee3741e30ec6638a89024f02e65c71..327099c1c9ccef8c51b8e0e71aecf4739d50d344 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -99,7 +99,17 @@ static int from_nr_ue_fd = -1;
 static int to_nr_ue_fd = -1;
 int slrb_id;
 int send_ue_information = 0;
+// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE)
+static const uint32_t timeToTrigger_ms[16] = {0, 40, 64, 80, 100, 128, 160, 256, 320, 480, 512, 640, 1024, 1280, 2560, 5120};
 
+/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */
+static const float RSRP_meas_mapping[98] = {-140, -139, -138, -137, -136, -135, -134, -133, -132, -131, -130, -129, -128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116,
+                                            -115, -114, -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,  -98,  -97,  -96,  -95,  -94,  -93,  -92,  -91,
+                                            -90,  -89,  -88,  -87,  -86,  -85,  -84,  -83,  -82,  -81,  -80,  -79,  -78,  -77,  -76,  -75,  -74,  -73,  -72,  -71,  -70,  -69,  -68,  -67,  -66,
+                                            -65,  -64,  -63,  -62,  -61,  -60,  -59,  -58,  -57,  -56,  -55,  -54,  -53,  -52,  -51,  -50,  -49,  -48,  -47,  -46,  -45,  -44,  -43};
+
+static const float RSRQ_meas_mapping[35] = {-19, -18.5, -18, -17.5, -17, -16.5, -16, -15.5, -15, -14.5, -14, -13.5, -13, -12.5, -12, -11.5, -11, -10.5,
+                                            -10, -9.5,  -9,  -8.5,  -8,  -7.5,  -7,  -6.5,  -6,  -5.5,  -5,  -4.5,  -4,  -3.5,  -3,  -2.5,  -2};
 // for malloc_clear
 #include "PHY/defs_UE.h"
 
diff --git a/openair2/RRC/LTE/rrc_common.c b/openair2/RRC/LTE/rrc_common.c
index 1744719308acf52be3890802fc920ba1e24dd075..c40d0ff76635784f1c42a57a050d7b411788446e 100644
--- a/openair2/RRC/LTE/rrc_common.c
+++ b/openair2/RRC/LTE/rrc_common.c
@@ -42,6 +42,7 @@
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "rrc_eNB_UE_context.h"
 #include "common/ran_context.h"
+#include "openair2/RRC/LTE/rrc_proto.h"
 
 extern RAN_CONTEXT_t RC;
 extern UE_MAC_INST *UE_mac_inst;
@@ -95,12 +96,7 @@ rrc_config_buffer(
 
 
 //-----------------------------------------------------------------------------
-long
-binary_search_int(
-  int elements[],
-  long numElem,
-  int value
-)
+long binary_search_int(const int elements[], long numElem, int value)
 //-----------------------------------------------------------------------------
 {
   long first, last, middle, search = -1;
@@ -141,12 +137,7 @@ binary_search_int(
    Used for RSRP and RSRQ measurement mapping. Can potentially be used for other things
 */
 //-----------------------------------------------------------------------------
-long
-binary_search_float(
-  float elements[],
-  long numElem,
-  float value
-)
+long binary_search_float(const float elements[], long numElem, float value)
 //-----------------------------------------------------------------------------
 {
   long first, last, middle;
diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h
index f0fc2275ac431096878d6ae46ac5596247a555d4..ecf2cd12f15619138081965bb88ac6d0b2ac5a11 100644
--- a/openair2/RRC/LTE/rrc_defs.h
+++ b/openair2/RRC/LTE/rrc_defs.h
@@ -44,12 +44,11 @@
 #include "NR_UE-MRDC-Capability.h"
 #include "NR_UE-NR-Capability.h"
 
-
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "COMMON/platform_types.h"
 
 #include "LAYER2/MAC/mac.h"
-
+#include "openair2/RRC/common.h"
 //for D2D
 #define DEBUG_CTRL_SOCKET
 
diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h
index 7f7fd6579e088532a36600e15b149a3de83762f1..14de4d8dcccd2bb8c8ea1fc0865c6533639fbc42 100644
--- a/openair2/RRC/LTE/rrc_extern.h
+++ b/openair2/RRC/LTE/rrc_extern.h
@@ -34,6 +34,7 @@
 #include "COMMON/mac_rrc_primitives.h"
 #include "LAYER2/MAC/mac.h"
 #include "LAYER2/RLC/rlc.h"
+#include "openair2/RRC/LTE/rrc_defs.h"
 
 extern UE_RRC_INST *UE_rrc_inst;
 
@@ -43,10 +44,7 @@ extern uint8_t DRB2LCHAN[8];
 extern LTE_LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue;
 extern LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
 
-
-extern unsigned char NB_INST;
-extern unsigned char NB_eNB_INST;
-extern uint16_t NB_UE_INST;
+extern int NB_UE_INST;
 extern void* bigphys_malloc(int);
 
 
@@ -59,15 +57,6 @@ extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_
 extern MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
 extern MAC_AVG_T BCCH_MEAS_AVG,CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
 
-extern uint16_t T300[8];
-extern uint16_t T310[8];
-extern uint16_t N310[8];
-extern uint16_t N311[8];
-extern uint32_t T304[8];
-extern uint32_t timeToTrigger_ms[16];
-extern float RSRP_meas_mapping[98];
-extern float RSRQ_meas_mapping[35];
-
 extern UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
 extern pthread_mutex_t ue_pf_po_mutex;
 
diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h
index fa469503af1d75e2aa4bc95331aeeb86fcd0b49a..a54a7a7336e6d9ec9d463b9a7dc50447b2d69c75 100644
--- a/openair2/RRC/LTE/rrc_proto.h
+++ b/openair2/RRC/LTE/rrc_proto.h
@@ -655,9 +655,9 @@ rrc_eNB_free_UE(
   const struct rrc_eNB_ue_context_s         *const ue_context_pP
 );
 
-long binary_search_int(int elements[], long numElem, int value);
+long binary_search_int(const int elements[], long numElem, int value);
 
-long binary_search_float(float elements[], long numElem, float value);
+long binary_search_float(const float elements[], long numElem, float value);
 
 void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
 
diff --git a/openair2/RRC/LTE/rrc_vars.h b/openair2/RRC/LTE/rrc_vars.h
index dfb019193c14ea41a8b551471ba1d56c2d530e26..f0495a7649d299b4debbe5c82c878591c7655182 100644
--- a/openair2/RRC/LTE/rrc_vars.h
+++ b/openair2/RRC/LTE/rrc_vars.h
@@ -35,13 +35,12 @@
 #include "LAYER2/RLC/rlc.h"
 #include "COMMON/mac_rrc_primitives.h"
 #include "LAYER2/MAC/mac.h"
+#include "openair2/RRC/NR/nr_rrc_extern.h"
 
 UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
 pthread_mutex_t ue_pf_po_mutex;
 UE_RRC_INST *UE_rrc_inst = NULL;
 #include "LAYER2/MAC/mac_extern.h"
-#define MAX_U32 0xFFFFFFFF
-
 extern uint16_t ue_id_g;
 
 uint8_t DRB2LCHAN[8];
@@ -86,156 +85,6 @@ LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DT
 MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
 MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
 
-// timers
-uint16_t T300[8] = {100,200,300,400,600,1000,1500,2000};
-uint16_t T310[8] = {0,50,100,200,500,1000,2000};
-uint16_t N310[8] = {1,2,3,4,6,8,10,20};
-uint16_t N311[8] = {1,2,3,4,6,8,10,20};
-uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32};
-
-// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE)
-uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120};
-
-/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */
-float RSRP_meas_mapping[98] = {
-  -140,
-    -139,
-    -138,
-    -137,
-    -136,
-    -135,
-    -134,
-    -133,
-    -132,
-    -131,
-    -130,
-    -129,
-    -128,
-    -127,
-    -126,
-    -125,
-    -124,
-    -123,
-    -122,
-    -121,
-    -120,
-    -119,
-    -118,
-    -117,
-    -116,
-    -115,
-    -114,
-    -113,
-    -112,
-    -111,
-    -110,
-    -109,
-    -108,
-    -107,
-    -106,
-    -105,
-    -104,
-    -103,
-    -102,
-    -101,
-    -100,
-    -99,
-    -98,
-    -97,
-    -96,
-    -95,
-    -94,
-    -93,
-    -92,
-    -91,
-    -90,
-    -89,
-    -88,
-    -87,
-    -86,
-    -85,
-    -84,
-    -83,
-    -82,
-    -81,
-    -80,
-    -79,
-    -78,
-    -77,
-    -76,
-    -75,
-    -74,
-    -73,
-    -72,
-    -71,
-    -70,
-    -69,
-    -68,
-    -67,
-    -66,
-    -65,
-    -64,
-    -63,
-    -62,
-    -61,
-    -60,
-    -59,
-    -58,
-    -57,
-    -56,
-    -55,
-    -54,
-    -53,
-    -52,
-    -51,
-    -50,
-    -49,
-    -48,
-    -47,
-    -46,
-    -45,
-    -44,
-    -43
-  };
-
-float RSRQ_meas_mapping[35] = {
-  -19,
-    -18.5,
-    -18,
-    -17.5,
-    -17,
-    -16.5,
-    -16,
-    -15.5,
-    -15,
-    -14.5,
-    -14,
-    -13.5,
-    -13,
-    -12.5,
-    -12,
-    -11.5,
-    -11,
-    -10.5,
-    -10,
-    -9.5,
-    -9,
-    -8.5,
-    -8,
-    -7.5,
-    -7,
-    -6.5,
-    -6,
-    -5.5,
-    -5,
-    -4.5,
-    -4,
-    -3.5,
-    -3,
-    -2.5,
-    -2
-  };
-
 // only used for RRC connection re-establishment procedure TS36.331 5.3.7
 // [0]: current C-RNTI, [1]: prior C-RNTI
 // insert one when eNB received RRCConnectionReestablishmentRequest message
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
index e52e637dd8b8f006346b13e1ee07366ae5be4630..299e0acaa912226468d72416aff1fdf0809365ae 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -148,10 +148,6 @@ typedef struct xer_sprint_string_s {
   size_t string_index;
 } xer_sprint_string_t;
 
-//replace LTE
-//extern unsigned char NB_eNB_INST;
-extern unsigned char NB_gNB_INST;
-
 extern RAN_CONTEXT_t RC;
 
 /*
diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h
index a8245dd66d298707bd8d1894ba469f8fefff55b8..6b60d648425136b2fd02fd9362c317bf587eac5f 100644
--- a/openair2/RRC/NR/nr_rrc_defs.h
+++ b/openair2/RRC/NR/nr_rrc_defs.h
@@ -40,7 +40,7 @@
 #include "nr_rrc_types.h"
 
 #include "common/ngran_types.h"
-#include "COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 #include "COMMON/platform_types.h"
 #include "mac_rrc_dl.h"
 
diff --git a/openair2/RRC/NR/nr_rrc_extern.h b/openair2/RRC/NR/nr_rrc_extern.h
index af2cfdd2c82e44ec50b8d3aee4f3d5d0da6d54c6..85faa6069749f904a38a8f88d962d12bb1b1c657 100644
--- a/openair2/RRC/NR/nr_rrc_extern.h
+++ b/openair2/RRC/NR/nr_rrc_extern.h
@@ -34,6 +34,8 @@
 #include "COMMON/mac_rrc_primitives.h"
 #include "LAYER2/MAC/mac.h"
 #include "LAYER2/RLC/rlc.h"
+#include "openair2/RRC/LTE/rrc_defs.h"
+#include "openair2/RRC/common.h"
 
 #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits.
 
@@ -45,10 +47,7 @@ extern NR_LogicalChannelConfig_t NR_SRB1_logicalChannelConfig_defaultValue;
 extern NR_LogicalChannelConfig_t NR_SRB2_logicalChannelConfig_defaultValue;
 extern NR_LogicalChannelConfig_t NR_SRB3_logicalChannelConfig_defaultValue;
 
-
-extern unsigned char NB_INST;
-extern unsigned char NB_eNB_INST;
-extern uint16_t NB_UE_INST;
+extern int NB_UE_INST;
 extern void* bigphys_malloc(int);
 
 
@@ -61,15 +60,6 @@ extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_
 extern MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
 extern MAC_AVG_T BCCH_MEAS_AVG,CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
 
-extern uint16_t T300[8];
-extern uint16_t T310[8];
-extern uint16_t N310[8];
-extern uint16_t N311[8];
-extern uint32_t T304[8];
-extern uint32_t timeToTrigger_ms[16];
-extern float RSRP_meas_mapping[98];
-extern float RSRQ_meas_mapping[35];
-
 extern UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
 
 extern pthread_mutex_t ue_pf_po_mutex;
diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c
index a9c03885f7ac02e652d8536856cb49f46ce4e589..93d459b3ed5722759dd9cbe329a0a53197cbe157 100644
--- a/openair2/RRC/NR_UE/rrc_UE.c
+++ b/openair2/RRC/NR_UE/rrc_UE.c
@@ -1345,7 +1345,13 @@ static void rrc_ue_generate_RRCSetupComplete(
    ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index);
   LOG_D(NR_RRC,
        "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
-       ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, nr_rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
+        ctxt_pP->frame,
+        ctxt_pP->module_id,
+        size,
+        gNB_index,
+        nr_rrc_mui,
+        ctxt_pP->module_id + NB_eNB_INST,
+        DCCH);
 
   //for (int i=0;i<size;i++) printf("%02x ",buffer[i]);
   //printf("\n");
diff --git a/openair1/PHY/MODULATION/modulation_vars.h b/openair2/RRC/common.h
similarity index 71%
rename from openair1/PHY/MODULATION/modulation_vars.h
rename to openair2/RRC/common.h
index 1428d5f9750388183d0f980caca2eb12d608f982..e9792298d230fcfa44001295c2f763ca1f9e7ae1 100644
--- a/openair1/PHY/MODULATION/modulation_vars.h
+++ b/openair2/RRC/common.h
@@ -19,7 +19,12 @@
  *      contact@openairinterface.org
  */
 
+#ifndef __OPENAIR_RRC_COMMON_H___
+#define __OPENAIR_RRC_COMMON_H___
+static const uint16_t T300[8] = {100, 200, 300, 400, 600, 1000, 1500, 2000};
+static const uint16_t T310[8] = {0, 50, 100, 200, 500, 1000, 2000};
+static const uint16_t N310[8] = {1, 2, 3, 4, 6, 8, 10, 20};
+static const uint16_t N311[8] = {1, 2, 3, 4, 6, 8, 10, 20};
+static const uint32_t T304[8] = {50, 100, 150, 200, 500, 1000, 2000, UINT32_MAX};
 
-short conjugate75[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
-short conjugate75_2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ;
-short negate[8]__attribute__((aligned(16))) = {-1,-1,-1,-1,-1,-1,-1,-1};
+#endif
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index 0d9943064070caab5afb1be339cd08d7bffeeb35..31422d5e2804be1ebbe4a74643f6ea1c67f9f3e1 100644
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -36,7 +36,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#include "openair2/COMMON/platform_constants.h"
+#include "common/platform_constants.h"
 //-----------------------------------------------------------------------------
 
 typedef struct mem_block_t {
diff --git a/openair2/UTIL/OTG/otg_defs.h b/openair2/UTIL/OTG/otg_defs.h
index e1107f824d1afbb773513e8fb9323bb74a69b6e5..3f4f31e63b2616a5fdbad8b29df12b331752033c 100644
--- a/openair2/UTIL/OTG/otg_defs.h
+++ b/openair2/UTIL/OTG/otg_defs.h
@@ -35,7 +35,7 @@
 
 /* \brief To define the NUMBER_OF_eNB_MAX and MAX_MOBILES_PER_ENB */
 #include "common/openairinterface5g_limits.h"
-#include <openair2/COMMON/platform_constants.h>
+#include <common/platform_constants.h>
 #include "otg_config.h"
 
 /**
diff --git a/openair2/UTIL/OTG/otg_form.c b/openair2/UTIL/OTG/otg_form.c
index 7a421eef608307e852e99765b9293821e42eac3d..928e8efeaf95d7ebb72984b88730cf967f87cac1 100644
--- a/openair2/UTIL/OTG/otg_form.c
+++ b/openair2/UTIL/OTG/otg_form.c
@@ -35,7 +35,6 @@
 #include "otg_externs.h"
 #include "otg_kpi.h"
 
-extern unsigned char NB_eNB_INST;
 extern uint16_t NB_UE_INST;
 
 FD_otg *form_dl, *form_ul;
diff --git a/openair2/UTIL/OTG/otg_kpi.c b/openair2/UTIL/OTG/otg_kpi.c
index c55aecf2390d13508cd4ac1ab9493790b073eada..52aaa4e436e76c11e6da2b4c21272069007406fa 100644
--- a/openair2/UTIL/OTG/otg_kpi.c
+++ b/openair2/UTIL/OTG/otg_kpi.c
@@ -40,7 +40,6 @@ unsigned int start_log_jitter=0;
 #include "otg_kpi.h"
 #include "otg_externs.h"
 
-extern unsigned char NB_eNB_INST;
 extern uint16_t NB_UE_INST;
 
 void tx_throughput(int src, int dst, int application) {
diff --git a/openair2/UTIL/OTG/otg_rx.c b/openair2/UTIL/OTG/otg_rx.c
index 4cd0496bde2a2509bc93a117aad57d0d0f762496..135378ff3b0cdeede395064cc69148136d4b7574 100644
--- a/openair2/UTIL/OTG/otg_rx.c
+++ b/openair2/UTIL/OTG/otg_rx.c
@@ -43,7 +43,6 @@
   #include <sql_common.h>
 #endif
 
-extern unsigned char NB_eNB_INST;
 extern uint16_t NB_UE_INST;
 
 //#include "LAYER2/MAC/extern.h"
diff --git a/openair2/UTIL/OTG/otg_tx.c b/openair2/UTIL/OTG/otg_tx.c
index a8ba83bc40d7a5eacc7c3b5fb2a1249ed3499e29..a43160ccd85bd4ae66fdeed0fb422f624780007b 100644
--- a/openair2/UTIL/OTG/otg_tx.c
+++ b/openair2/UTIL/OTG/otg_tx.c
@@ -35,7 +35,6 @@
 #include "otg_tx.h"
 #include "otg_externs.h"
 
-extern unsigned char NB_eNB_INST;
 extern uint16_t NB_UE_INST;
 
 
diff --git a/openair2/UTIL/OTG/otg_tx.h b/openair2/UTIL/OTG/otg_tx.h
index c5b0c01dfca48a6556aba7e2bf3fc9ec546fb35c..355294a8f49e6e73e88f012c67e6c0d761ad73b0 100644
--- a/openair2/UTIL/OTG/otg_tx.h
+++ b/openair2/UTIL/OTG/otg_tx.h
@@ -41,10 +41,7 @@
 #include <math.h>
 #include <unistd.h>
 
-
 #include "otg.h"
-//#include "COMMON/platform_constants.h"
-
 
 /*! \fn int time_dist(const int src, const int dst, const int state)
 * \brief compute Inter Departure Time, in ms
diff --git a/openair3/MME_APP/mme_config.h b/openair3/MME_APP/mme_config.h
index 2eb0a66e85c07bc2ab4461750bb26b223dfcf2e1..6500404d63a5adfdb7268afbd486abe2d2262471 100644
--- a/openair3/MME_APP/mme_config.h
+++ b/openair3/MME_APP/mme_config.h
@@ -36,7 +36,7 @@
 
 #include "commonDef.h"
 #include "platform_types.h"
-#include "platform_constants.h"
+#include "common/platform_constants.h"
 #include "PHY/impl_defs_top.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c
index c6762a712812dc3cdeb247d08694c3e741920106..2f9c8114d866b6adf1a09188129add170c6dacf6 100644
--- a/openair3/NAS/UE/nas_itti_messaging.c
+++ b/openair3/NAS/UE/nas_itti_messaging.c
@@ -23,6 +23,7 @@
 
 #include "intertask_interface.h"
 #include "nas_itti_messaging.h"
+#include "common/ran_context.h"
 
 #   define TASK_ORIGIN  TASK_NAS_UE
 
@@ -95,10 +96,6 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
 }
 #endif
 
-
-
-extern unsigned char NB_eNB_INST;
-
 int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) {
   MessageDef *message_p;
   message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_KENB_REFRESH_REQ);
diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c
index f47af8cb66a3a1a0bb20e1e161d3f558d2b2198d..b4e096c9290c8cac46244b3b5180d9bad7f829b4 100644
--- a/openair3/NAS/UE/nas_ue_task.c
+++ b/openair3/NAS/UE/nas_ue_task.c
@@ -32,11 +32,11 @@
 # include "memory.h"
 
 #include "nas_user.h"
+#include "common/ran_context.h"
 // FIXME make command line option for NAS_UE_AUTOSTART
 # define NAS_UE_AUTOSTART 1
 
 // FIXME review these externs
-extern unsigned char NB_eNB_INST;
 extern uint16_t NB_UE_INST;
 
 uint16_t ue_idx_standalone = 0xFFFF;
diff --git a/targets/TEST/PACKET_TRACER/pt.c b/targets/TEST/PACKET_TRACER/pt.c
index cc3b62728c3948d07001fd0baa367cf27c05a65b..54f3a09405c15284b646b50a9ce3aa96638658c6 100644
--- a/targets/TEST/PACKET_TRACER/pt.c
+++ b/targets/TEST/PACKET_TRACER/pt.c
@@ -476,6 +476,7 @@ u16 attach_ue4(char *dcch_sdu_eNB, char dcch_sdu_eNB_len, char *dcch_sdu_ue)
 }
 
 //u8 NB_INST=2;
+const int NB_UE_INST = 1;
 
 int main (int argc, char **argv)
 {
@@ -492,10 +493,6 @@ int main (int argc, char **argv)
 
   logInit();
 
-  NB_UE_INST  = 1;
-  NB_eNB_INST = 1;
-  NB_INST=2;
-
   // Parse arguments
   if(parse_args(argc, argv, &args) > 0) {
     print_usage(argv[0]);
diff --git a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
index 7b8017172435300c4d3ef7a4044724263d90f1d3..507521ee1e1ae76437854e4be569a143fe967973 100644
--- a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
+++ b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c
@@ -224,7 +224,6 @@ int main(int argc, char **argv)
   char * g_log_level = "trace"; // by default global log level is set to trace
 
   mac_xface = malloc(sizeof(MAC_xface));
-  Mac_rlc_xface = (MAC_RLC_XFACE*)malloc16(sizeof(MAC_RLC_XFACE));
 
   rlc_module_init (1);
   pdcp_module_init();