diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 1ed02b5b4e3d6e9989281f1944c13caacc70fddd..bfe03358c0fcdb6dbd5eeb39c551264af370edae 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -2001,6 +2001,8 @@ add_executable(lte-softmodem
   ${OPENAIR_TARGETS}/COMMON/create_tasks.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
+  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
+  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
   ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
   ${OPENAIR_DIR}/common/utils/utils.c
   ${OPENAIR_DIR}/common/utils/system.c
@@ -2143,96 +2145,6 @@ target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt cry
 target_link_libraries (lte-uesoftmodem-nos1  ${LIB_LMS_LIBRARIES})
 target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
 
-# lte-softmodem-stub-nos1 is both eNB and UE implementation
-###################################################
-
-add_executable(lte-softmodem-stub-nos1
-  ${rrc_h}
-  ${s1ap_h}
-  ${OPENAIR_BIN_DIR}/messages_xml.h
-  ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-stub.c
-  ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
-  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
-  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
-  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
-  ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
-  #${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
-  ${OPENAIR_DIR}/common/utils/utils.c
-  ${OPENAIR_DIR}/common/utils/system.c
-  #${GTPU_need_ITTI}
-  #${RTAI_SOURCE}
-  ${XFORMS_SOURCE}
-  ${XFORMS_SOURCE_SOFTMODEM}
-  ${T_SOURCE}
-  ${CONFIG_SOURCES}
-  ${SHLIB_LOADER_SOURCES}
-  )
-
-target_link_libraries (lte-softmodem-stub-nos1
-  -Wl,--start-group
-  RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-  NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
-  NFAPI_USER_LIB
-  -Wl,--end-group z dl)
-
-target_link_libraries (lte-softmodem-stub-nos1 ${LIBXML2_LIBRARIES})
-target_link_libraries (lte-softmodem-stub-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}  ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
-target_link_libraries (lte-softmodem-stub-nos1 ${LIB_LMS_LIBRARIES})
-target_link_libraries (lte-softmodem-stub-nos1 ${T_LIB})
-
-
-
-
-
-
-# lte-softmodem-stub is both eNB and UE implementation
-###################################################
-
-add_executable(lte-softmodem-stub
-  ${rrc_h}
-  ${s1ap_h}
-  ${OPENAIR_BIN_DIR}/messages_xml.h
-  ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
-  ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-stub.c
-  ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
-  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
-  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
-  ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
-  ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
-  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
-  ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
-  ${OPENAIR_DIR}/common/utils/utils.c
-  ${OPENAIR_DIR}/common/utils/system.c
-  ${GTPU_need_ITTI}
-  #${RTAI_SOURCE}
-  ${XFORMS_SOURCE}
-  ${XFORMS_SOURCE_SOFTMODEM}
-  ${T_SOURCE}
-  ${CONFIG_SOURCES}
-  ${SHLIB_LOADER_SOURCES}
-  )
-
-target_link_libraries (lte-softmodem-stub
-  -Wl,--start-group
-  RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-  NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
-  NFAPI_USER_LIB
-  -Wl,--end-group z dl)
-
-target_link_libraries (lte-softmodem-stub ${LIBXML2_LIBRARIES})
-target_link_libraries (lte-softmodem-stub pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp  ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}  ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
-target_link_libraries (lte-softmodem-stub ${LIB_LMS_LIBRARIES})
-target_link_libraries (lte-softmodem-stub ${T_LIB})
 
 
 # USIM process
@@ -2471,7 +2383,7 @@ endforeach(myExe)
 if (${T_TRACER})
   foreach(i
         #all "add_executable" definitions (except tests, rb_tool, updatefw)
-        lte-softmodem lte-softmodem-stub lte-softmodem-nos1 oaisim oaisim_nos1
+        lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1
 
         dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
         pdcchsim pucchsim prachsim syncsim
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 8c65c0c2b29b5c2998a1a2d69318610e244cf4fb..04bd45e48e2ac4c5fa68c82e5aa7e638039c5040 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -499,14 +499,6 @@ function main() {
   DIR=$OPENAIR_DIR/cmake_targets
   if [ "$NOS1" =  "1" ] ; then
       lte_build_dir=lte_noS1_build_oai
-#<<<<<<< HEAD
-#      #lte_exec=lte-softmodem-nos1
-#      lte_exec=lte-softmodem-stub-nos1
-#  else
-#      lte_build_dir=lte_build_oai
-#      #lte_exec=lte-softmodem
-#      lte_exec=lte-softmodem-stub
-#=======
       if [ "$eNB" = "1" ] ; then
          lte_exec=lte-softmodem-nos1
       fi
@@ -521,7 +513,6 @@ function main() {
       if [ "$UE" = "1" ] ; then
          lte_exec=lte-uesoftmodem
       fi
-#>>>>>>> main/develop
   fi
 
 # configuration module libraries, one currently available, using libconfig 
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
index fcca18241c36bcc84e076591b551b37b363f5ccc..56de8ae581b818d22feeb7613bf92eadf3044016 100644
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -1832,7 +1832,6 @@ static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePacked
 	nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
 	
 	if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0){
-		printf("Panos-D: pack_crc_indication_body_value 0 \n");
 		return 0;
 	}
 
@@ -1844,13 +1843,11 @@ static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePacked
 		
 		uint8_t* instance_length_p = *ppWritePackedMsg;
 		if(!push16(pdu->instance_length, ppWritePackedMsg, end)){
-			printf("Panos-D: pack_crc_indication_body_value 1 \n");
 			return 0;
 		}
 		
 		if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
 			 pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))){
-			printf("Panos-D: pack_crc_indication_body_value 2 \n");
 			return 0;
 		}
 
@@ -1965,7 +1962,6 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
 		}
 
 		if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0){
-			printf("Panos-D: pack_rx_ulsch_indication_body_value() 2 about to return error \n");
 			return 0;
 		}
 	}
@@ -2788,7 +2784,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
 	pMessageHeader->message_length = packedMsgLen16;
 	
 	if(!push16(packedMsgLen16, &pPackedLengthField, end)){
-		printf("Panos-D: Pack function failed. Returning... \n");
+		//printf("Panos-D: Pack function failed. Returning... \n");
 		return -1;
 	}
 		
@@ -2797,7 +2793,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
 		//quick test
 		if(pMessageHeader->message_length != packedMsgLen)
 		{
-			printf("Panos-D: nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+			//printf("Panos-D: nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
 			NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
 		}
 	}
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
index 2ea0fae13200be063629049a1dea61a204919051..28c4fe38a6248e08410133df37d972c9f43bd9c5 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
@@ -416,14 +416,14 @@ int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t len)
 	int sendto_result;
 	if ((sendto_result = sendto((int)pnf_p7->p7_sock, (const char*)msg, len, 0, (const struct sockaddr*)&remote_addr, remote_addr_len)) < 0)
 	{
-		printf("Panos-D: %s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len,  errno);
+		//printf("Panos-D: %s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len,  errno);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len,  errno);
 		return -1;
 	}
 
 	if(sendto_result != len)
 	{
-		printf("Panos-D: %s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
+		//printf("Panos-D: %s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
 	}
 	return 0;
@@ -436,7 +436,7 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
 	// Need to guard against different threads calling the encode function at the same time
 	if(pthread_mutex_lock(&(pnf_p7->pack_mutex)) != 0)
 	{
-		printf("Panos-D: failed to lock mutex 1\n");
+		//printf("Panos-D: failed to lock mutex 1\n");
 		NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
 		return -1;
 	}
@@ -447,12 +447,12 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
 	{
 		if(pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0)
 		{
-			printf("Panos-D: failed to unlock mutex 2\n");
+			//printf("Panos-D: failed to unlock mutex 2\n");
 			NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
 			return -1;
 		}
 		
-		printf("Panos-D: nfapi_p7_message_pack failed with return %d\n", len);
+		//printf("Panos-D: nfapi_p7_message_pack failed with return %d\n", len);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p7_message_pack failed with return %d\n", len );
 		return -1;
 	}
@@ -466,7 +466,7 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
 		int segment = 0;
 		int offset = NFAPI_P7_HEADER_LENGTH;
 		uint8_t buffer[pnf_p7->_public.segment_size];
-		printf("Panos-D: pnf_p7_pack_and_send_p7_message sending through multiple segments \n");
+		//printf("Panos-D: pnf_p7_pack_and_send_p7_message sending through multiple segments \n");
 		for(segment = 0; segment < segment_count; ++segment)
 		{
 			uint8_t last = 0;
@@ -826,7 +826,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
 		}
 		else if(pnf_p7->_public.timing_info_mode_aperiodic && pnf_p7->timing_info_aperiodic_send)
 		{
-			printf("Panos-D: Sending aperiodic timing info message \n");
+			printf("Sending aperiodic timing info message \n");
 			pnf_pack_and_send_timing_info(pnf_p7);
 
 			pnf_p7->timing_info_aperiodic_send = 0;
@@ -1369,7 +1369,7 @@ void pnf_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7, u
 	// unpack the message
 	if (nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &dl_node_sync, sizeof(dl_node_sync), &pnf_p7->_public.codec_config) < 0)
 	{
-		printf("Panos-D: %s: Unpack message failed, ignoring\n", __FUNCTION__);
+		//printf("Panos-D: %s: Unpack message failed, ignoring\n", __FUNCTION__);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
 		return;
 	}
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
index faa667f2ba30aea0dd5c887f0be74467f1460374..c7e99d25631580a750c30fd42b1b37dd2e1bfa7d 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
@@ -117,7 +117,6 @@ int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t*
 {
 	if(config == NULL || ind == NULL)
 	{
-		printf("Panos-D: %s: invalid input params\n", __FUNCTION__);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
 		return -1;
 	}
@@ -129,7 +128,6 @@ int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* in
 {
 	if(config == NULL || ind == NULL)
 	{
-		printf("Panos-D: %s: invalid input params\n", __FUNCTION__);
 		NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
 		return -1;
 	}
diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index 2f2732cb0a113b608fd411f242a5863e0d87fe09..be3e5c160b61a7ad71562befd3f2da89cd3a8fb0 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -370,8 +370,6 @@ void phy_cleanup(void);
 
 void phy_config_request(PHY_Config_t *phy_config);
 
-void phy_config_request_ue(UE_PHY_Config_t* UE_config_INFO);
-
 int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
 void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
 
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index 9a19b0ddaf3dee79997ca3af075bd9448b74d43b..bb0ae8e11cee2ee59987b62b80d12945abbe40ba 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -1278,7 +1278,7 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
     int32_t         IP_CsData_allsfavg[NB_ANTENNAS_RX][14][4][2];
     int32_t         IP_allavg[D_NPUCCH_SF5];
     //int16_t         temp_ch[2];
-	int16_t         m[NUMBER_OF_UE_MAX], m_self, same_m_number;
+	int16_t         m[NUMBER_OF_UE_MAX], m_self=0, same_m_number;
 	uint16_t        n3_pucch_sameRB[NUMBER_OF_UE_MAX];
 	int16_t         n_oc0[NUMBER_OF_UE_MAX];
 	int16_t         n_oc1[NUMBER_OF_UE_MAX];
diff --git a/openair1/PHY/LTE_TRANSPORT/sldch.c b/openair1/PHY/LTE_TRANSPORT/sldch.c
index dc68b70e956b6f07792771bd2f607f7c9c96c6e0..64d13c46890bc1f55184fd34e79e30969ea2208b 100644
--- a/openair1/PHY/LTE_TRANSPORT/sldch.c
+++ b/openair1/PHY/LTE_TRANSPORT/sldch.c
@@ -33,6 +33,7 @@
 #define __LTE_TRANSPORT_SLSS__C__
 #include "PHY/defs.h"
 
+extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
 
 void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx) {
 
diff --git a/openair1/PHY/LTE_TRANSPORT/slsch.c b/openair1/PHY/LTE_TRANSPORT/slsch.c
index 6237a2a6b4fa5df3eac619c5cca994a3c81671a7..9c199456e22f3c8d1a7e6a42c20895a55fa06f91 100644
--- a/openair1/PHY/LTE_TRANSPORT/slsch.c
+++ b/openair1/PHY/LTE_TRANSPORT/slsch.c
@@ -33,6 +33,9 @@
 #define __LTE_TRANSPORT_SLSS__C__
 #include "PHY/defs.h"
 
+extern int
+multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
+
 
 void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx) {
 
diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index 55c5e415996846f7f26b3eff580c395cb68c8a58..55425596d748ba1e0643e65a7c138f1c0ae5500e 100644
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -58,7 +58,7 @@
 #include "msc.h"
 
 #include "openair2/PHY_INTERFACE/IF_Module.h"
-#include "openair2/PHY_INTERFACE/IF_Module_UE.h"
+//#include "openair2/PHY_INTERFACE/IF_Module_UE.h"
 
 //#include <complex.h>
 #include "assertions.h"
@@ -1434,12 +1434,6 @@ typedef struct {
   /// N0 (used for abstraction)
   double N0;
 
-  /// Panos: Pointer to IF_Module_UE instance of the UE.
-  IF_Module_UE_t *if_inst_ue;
-
-  /// Panos: Pointer to DL.indication structure of the UE.
-  UE_DL_IND_t UE_DL_INFO;
-
   /// PDSCH Varaibles
   PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
 
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index a038ead62d6cdd68a8e8b7e0ae51d618d3be9723..b6f651d2e9ff9f6ddc0f5c283f252cc731c0dce7 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -1169,8 +1169,8 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
   LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
   LTE_eNB_ULSCH_t *ulsch;
   LTE_UL_eNB_HARQ_t *ulsch_harq;
-  struct timespec t_decode, t_crc,t_rx_ind,t_rx_ind_b,t_harq_a,t_harq_b,t_end;
-
+  struct timespec t_harq_a,t_harq_b;
+  //struct timespec t_decode, t_crc,t_rx_ind,t_rx_ind_b, t_end;
   const int subframe = proc->subframe_rx;
   const int frame    = proc->frame_rx;
   
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 5300ff90e8ad3426eb247a7ec132ec404e60db73..6f9aebbc1b5a2660dd663556c3f6bbc0160073ee 100644
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -2769,53 +2769,6 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
 }
 
-// Panos: New function supporting the MAC interface
-void fill_bch_indication(module_id_t   module_idP,
-		frame_t frameP,
-		unsigned char eNB_index,
-		uint8_t first_sync,
-		uint8_t sync)
-{
-
-}
-
-// Panos: New function supporting the MAC interface
-void fill_dlsch_indication(module_id_t module_idP,
-	    uint8_t CC_id,
-	    frame_t frameP,
-        sub_frame_t subframeP,
-	    uint8_t* sdu,
-	    uint16_t sdu_len,
-	    uint8_t eNB_index)
-{
-
-}
-
-// Panos: New function supporting the MAC interface
-void fill_dlsch_rar_indication(module_id_t module_idP,
-		  int CC_id,
-		  frame_t frameP,
-		  rnti_t ra_rnti,
-		  uint8_t* dlsch_buffer,
-		  rnti_t* t_crnti,
-		  uint8_t preamble_index,
-		  uint8_t* selected_rar_buffer)
-{
-
-}
-
-// PANOS: New function supporting the MAC interface
-
-void fill_Tx_indication(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id, uint8_t Tx_ind_type)
-{
-	switch (Tx_ind_type)
-	{
-	case UE_MAC_Tx_IND_Msg1_TYPE:
-		break;
-	case UE_MAC_Tx_IND_Msg3_TYPE:
-		break;
-	}
-}
 
 
 int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t abstraction_flag)
diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h
index 52a2563ffcda87b8383bcd539666c5e1041033be..4d9b4c0c6872b0bc5f9e5b9ed88e6965f3178a64 100755
--- a/openair2/ENB_APP/enb_paramdef.h
+++ b/openair2/ENB_APP/enb_paramdef.h
@@ -538,44 +538,44 @@ typedef enum {
 {ENB_CONFIG_STRING_UETIMERS_N310,                                NULL,   0,           iptr:&ue_TimersAndConstants_n310,               defintval:20,              TYPE_UINT,       0},  \
 {ENB_CONFIG_STRING_UETIMERS_N311,                                NULL,   0,           iptr:&ue_TimersAndConstants_n311,               defintval:1,               TYPE_UINT,       0},  \
 {ENB_CONFIG_STRING_UE_TRANSMISSION_MODE,                         NULL,   0,           iptr:&ue_TransmissionMode,                      defintval:1,               TYPE_UINT,       0},  \
-{ENB_CONFIG_STRING_RXPOOL_SC_CP_LEN,                             NULL,   0,   strptr:&rxPool_sc_CP_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_SC_PRIOD,                              NULL,   0,   strptr:&rxPool_sc_Period,          defstrval:"sf40",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_DATA_CP_LEN,                           NULL,   0,   strptr:&rxPool_data_CP_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_PRB_NUM,                            NULL,   0,   iptr:&rxPool_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_PRB_START,                          NULL,   0,   iptr:&rxPool_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_PRB_END,                            NULL,   0,   iptr:&rxPool_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_PRESENT,                  NULL,   0,   strptr:&rxPool_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_CHOICE,                   NULL,   0,   iptr:&rxPool_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_PRESENT,                   NULL,   0,   strptr:&rxPool_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_BUF,             NULL,   0,   strptr:&rxPool_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE,            NULL,   0,   iptr:&rxPool_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED, NULL,   0,   iptr:&rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_CP_LEN,                            NULL,   0,   strptr:&discRxPool_cp_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_DISCPERIOD,                        NULL,   0,   strptr:&discRxPool_discPeriod,          defstrval:"rf32",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_NUMRETX,                           NULL,   0,   iptr:&discRxPool_numRetx,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_NUMREPETITION,                     NULL,   0,   iptr:&discRxPool_numRepetition,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_NUM,                        NULL,   0,   iptr:&discRxPool_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_START,                      NULL,   0,   iptr:&discRxPool_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_END,                        NULL,   0,   iptr:&discRxPool_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_PRESENT,              NULL,   0,   strptr:&discRxPool_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_CHOICE,               NULL,   0,   iptr:&discRxPool_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_PRESENT,               NULL,   0,   strptr:&discRxPool_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_BUF,         NULL,   0,   strptr:&discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE,        NULL,   0,   iptr:&discRxPool_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL,   0,   iptr:&discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_CP_LEN,                            NULL,   0,   strptr:&discRxPoolPS_cp_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_DISCPERIOD,                        NULL,   0,   strptr:&discRxPoolPS_discPeriod,          defstrval:"rf32",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMRETX,                           NULL,   0,   iptr:&discRxPoolPS_numRetx,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMREPETITION,                     NULL,   0,   iptr:&discRxPoolPS_numRepetition,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_NUM,                        NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_START,                      NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_END,                        NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_PRESENT,              NULL,   0,   strptr:&discRxPoolPS_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_CHOICE,               NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_PRESENT,               NULL,   0,   strptr:&discRxPoolPS_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_BUF,         NULL,   0,   strptr:&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_SIZE,        NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
-{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL,   0,   iptr:&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0} \
+{ENB_CONFIG_STRING_RXPOOL_SC_CP_LEN,                             NULL,   0,   strptr:(char **)&rxPool_sc_CP_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_SC_PRIOD,                              NULL,   0,   strptr:(char **)&rxPool_sc_Period,          defstrval:"sf40",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_DATA_CP_LEN,                           NULL,   0,   strptr:(char **)&rxPool_data_CP_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_PRB_NUM,                            NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_PRB_START,                          NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_PRB_END,                            NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_PRESENT,                  NULL,   0,   strptr:(char **)&rxPool_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_OFFSETIND_CHOICE,                   NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_PRESENT,                   NULL,   0,   strptr:(char **)&rxPool_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_BUF,             NULL,   0,   strptr:(char **)&rxPool_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE,            NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_RXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED, NULL,   0,   iptr:(int32_t *)&rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_CP_LEN,                            NULL,   0,   strptr:(char **)&discRxPool_cp_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_DISCPERIOD,                        NULL,   0,   strptr:(char **)&discRxPool_discPeriod,          defstrval:"rf32",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_NUMRETX,                           NULL,   0,   iptr:(int32_t *)&discRxPool_numRetx,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_NUMREPETITION,                     NULL,   0,   iptr:(int32_t *)&discRxPool_numRepetition,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_NUM,                        NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_START,                      NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_PRB_END,                        NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_PRESENT,              NULL,   0,   strptr:(char **)&discRxPool_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_OFFSETIND_CHOICE,               NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_PRESENT,               NULL,   0,   strptr:(char **)&discRxPool_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_BUF,         NULL,   0,   strptr:(char **)&discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_SIZE,        NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOL_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL,   0,   iptr:(int32_t *)&discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_CP_LEN,                            NULL,   0,   strptr:(char **)&discRxPoolPS_cp_Len,          defstrval:"normal",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_DISCPERIOD,                        NULL,   0,   strptr:(char **)&discRxPoolPS_discPeriod,          defstrval:"rf32",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMRETX,                           NULL,   0,   iptr:(int32_t *)&discRxPoolPS_numRetx,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_NUMREPETITION,                     NULL,   0,   iptr:(int32_t *)&discRxPoolPS_numRepetition,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_NUM,                        NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_prb_Num,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_START,                      NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_prb_Start,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_PRB_END,                        NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_prb_End,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_PRESENT,              NULL,   0,   strptr:(char **)&discRxPoolPS_ResourceConfig_offsetIndicator_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_OFFSETIND_CHOICE,               NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_offsetIndicator_choice,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_PRESENT,               NULL,   0,   strptr:(char **)&discRxPoolPS_ResourceConfig_subframeBitmap_present,            defstrval:"prNothing",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_BUF,         NULL,   0,   strptr:(char **)&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf,            defstrval:"001001",  TYPE_STRING,  0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_SIZE,        NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size,         defintval:1,       TYPE_UINT,    0}, \
+{ENB_CONFIG_STRING_DISCRXPOOLPS_RC_SFBITMAP_CHOICE_BS_ASN_BITS_UNUSED,NULL,   0,   iptr:(int32_t *)&discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused,         defintval:1,       TYPE_UINT,    0} \
 }
 
 #define ENB_CONFIG_FRAME_TYPE_IDX                            0  			     
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index fdd70d1aa58ab92eba0f966e6dcff748eb5d5b8d..47830b0e103dcfaa71f348e030490b7af8b10b05 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -3204,7 +3204,7 @@ SLSS_t *ue_get_slss(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t su
 
 SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t subframe_tx) {
 
-    UE_MAC_INST *ue = &UE_mac_inst[Mod_id];
+    //UE_MAC_INST *ue = &UE_mac_inst[Mod_id];
     SLDCH_t *sldch = &UE_mac_inst[Mod_id].sldch;
     // Panos: Ask TTN if we should be calling mac_rrc_data_req_ue() instead of mac_rrc_data_req() now!
     /*sldch->payload_length = mac_rrc_data_req(Mod_id,
@@ -3222,7 +3222,7 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t
                 frame_tx,
                 SL_DISCOVERY,
                 1,
-                (char*)(sldch->payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0],
+                (uint8_t*)(sldch->payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0],
                 0, //eNB_indexP
                 0);
 
@@ -3240,7 +3240,7 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t
 
 SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframeP) {
 
-   mac_rlc_status_resp_t rlc_status, rlc_status_data;
+   mac_rlc_status_resp_t rlc_status; //, rlc_status_data;
    uint32_t absSF = (frameP*10)+subframeP;
    UE_MAC_INST *ue = &UE_mac_inst[module_idP];
    int rvtab[4] = {0,2,3,1};
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 640b7667df1cae36256f6e4d2de9129a9c7c4f81..140dccc8eb6b0b5076aeaa290454b42fe81fdcfc 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -469,7 +469,7 @@ int pdcp_pc5_sockfd;
 struct sockaddr_in prose_ctrl_addr;
 struct sockaddr_in prose_pdcp_addr;
 struct sockaddr_in pdcp_sin;
-int pdcp_pc5_socket_init();
+void pdcp_pc5_socket_init(void);
 
 typedef struct  {
    rb_id_t             rb_id;
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 6f63a837bfc18e269391ce438805c6cde3a40f96..ff82355c0d2cebaac392b08acef67bfa5c008863 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -487,13 +487,14 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
 #ifdef Rel14
    int prose_addr_len;
    char send_buf[BUFSIZE], receive_buf[BUFSIZE];
-   int optval;
+   // Panos: Remove the following definitions due to warnings of unused variables.
+   //int optval;
    int bytes_received;
    sidelink_pc5s_element *sl_pc5s_msg_recv = NULL;
    sidelink_pc5s_element *sl_pc5s_msg_send = NULL;
-   uint32_t sourceL2Id;
-   uint32_t groupL2Id;
-   module_id_t         module_id = 0;
+   //uint32_t sourceL2Id;
+   //uint32_t groupL2Id;
+   //module_id_t         module_id = 0;
    pc5s_header_t *pc5s_header;
 #endif
 
@@ -633,7 +634,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
    // receive a message from ProSe App
    memset(receive_buf, 0, BUFSIZE);
    bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
-         (struct sockaddr *) &prose_pdcp_addr, &prose_addr_len);
+         (struct sockaddr *) &prose_pdcp_addr, (socklen_t *)&prose_addr_len);
    //  if (bytes_received < 0){
    //    LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
    //    exit(EXIT_FAILURE);
@@ -720,7 +721,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                   key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                   h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
                   LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
-                        key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+                        (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
                } else {
                   rab_id = rab_id % maxDRB;
                   LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
@@ -728,7 +729,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                   key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
                   h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
                   LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
-                        key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+                		  (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
                }
 
                if (h_rc == HASH_TABLE_OK) {
@@ -1027,7 +1028,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                         key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                         h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
                         LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
-                              key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+                        		(uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
                      } else {
                         rab_id = rab_id % maxDRB;
                         LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
@@ -1035,7 +1036,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                         key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
                         h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
                         LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
-                              key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
+                        		(uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
                      }
 
                      if (h_rc == HASH_TABLE_OK) {
@@ -1186,12 +1187,12 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const  ctxt_pP)
 //TTN for D2D (PC5S)
 #ifdef Rel14
 
-int
+void
 pdcp_pc5_socket_init() {
-   pthread_attr_t     attr;
-   struct sched_param sched_param;
+	//pthread_attr_t     attr;
+   //struct sched_param sched_param;
    int optval; // flag value for setsockopt
-   int n; // message byte size
+   //int n; // message byte size
 
    //create PDCP socket
    pdcp_pc5_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
index 722c22660d6d8dae7e3bd8a6927ff519b19d0503..a939543432674fabc3568ce499ec32095656c675 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h
@@ -69,6 +69,6 @@ extern void     init_pdcp (struct pdcp_entity *pdcpP, struct rb_dispatcher *rbP,
 extern void    *pdcp_tx (void *argP);
 #endif
 
-void pdcp_pc5_socket_init();
+extern void pdcp_pc5_socket_init(void);
 
 #endif
diff --git a/openair2/PHY_INTERFACE/IF_Module_UE.c b/openair2/PHY_INTERFACE/IF_Module_UE.c
deleted file mode 100644
index 3951f95e33bb184e1af5a9f1c58a3f8e06bb20ee..0000000000000000000000000000000000000000
--- a/openair2/PHY_INTERFACE/IF_Module_UE.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include "openair1/PHY/defs.h"
-#include "openair2/PHY_INTERFACE/IF_Module_UE.h"
-#include "openair2/PHY_INTERFACE/UE_MAC_interface.h"
-#include "openair1/PHY/extern.h"
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/proto.h"
-#include "common/ran_context.h"
-
-IF_Module_UE_t *if_inst_ue;
-
-
-
-void handle_bch(UE_DL_IND_t *UE_DL_INFO)
-{
-
-}
-
-
-void handle_dlsch(UE_DL_IND_t *UE_DL_INFO)
-{
-	int i;
-	UE_MAC_dlsch_indication_pdu_t *dlsch_pdu_ind;
-
-	for (i=0; i<UE_DL_INFO->UE_DLSCH_ind.number_of_pdus; i++)
-	{
-		dlsch_pdu_ind = UE_DL_INFO->UE_DLSCH_ind.dlsch_ind_list[i];
-		switch (dlsch_pdu_ind->pdu_type) {
-
-		case UE_MAC_DL_IND_PDSCH_PDU_TYPE:
-				// Call ue_send_sdu()
-			break;
-
-		case UE_MAC_DL_IND_SI_PDSCH_PDU_TYPE:
-				// Call ue_decode_si()
-			break;
-
-		case UE_MAC_DL_IND_P_PDSCH_PDU_TYPE:
-				// Call ue_decode_p()
-			break;
-
-		case UE_MAC_DL_IND_DLSCH_RAR_PDU_TYPE:
-			   // Call ue_process_rar()
-			break;
-		}
-	}
-
-}
-
-
-void UE_DL_indication(UE_DL_IND_t *UE_DL_INFO)
-{
-
-    /*Call handle functions to forward PDUs or control indications to the upper layers.
-	handle_bch(UE_DL_INFO);
-	handle_dlsch (UE_DL_INFO);
-
-	Trigger ue_scheduler() ?
-	*/
-}
-
-/* Indicate the Txon of Msg1 or Msg3 to the MAC layer of the transmitter side and trigger associated
- * MAC layer operations */
-
-void UE_Tx_indication(UE_Tx_IND_t *UE_Tx_INFO)
-{
-	switch (UE_Tx_INFO->ind_type) {
-
-	case UE_MAC_Tx_IND_Msg1_TYPE:
-		//Call Msg1_transmitted()
-	break;
-
-	case UE_MAC_Tx_IND_Msg3_TYPE:
-		//Call Msg3_transmitted()
-	break;
-	}
-}
-
-/// Panos: Not sure about the implementation of this function.
-IF_Module_UE_t *IF_Module_ue_init(int Mod_id){
-
-  AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES);
-
-  if (if_inst_ue[Mod_id]==NULL) {
-    if_inst_ue[Mod_id] = (IF_Module_t*)malloc(sizeof(IF_Module_t));
-    memset((void*)if_inst_ue[Mod_id],0,sizeof(IF_Module_t));
-
-    //if_inst_ue[Mod_id]->CC_mask=0;
-    if_inst_ue[Mod_id]->UE_DL_indication = UE_DL_indication;
-    if_inst_ue[Mod_id]->UE_Tx_indication = UE_Tx_indication;
-
-    // Panos: Have to check about this.
-    /*AssertFatal(pthread_mutex_init(&if_inst_ue[Mod_id]->if_mutex,NULL)==0,
-		"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);*/
-  }
-  return if_inst[Mod_id];
-}
-
-
diff --git a/openair2/PHY_INTERFACE/IF_Module_UE.h b/openair2/PHY_INTERFACE/IF_Module_UE.h
deleted file mode 100644
index 9cd246906b073fe67d82f8330bf82d7e71234b1b..0000000000000000000000000000000000000000
--- a/openair2/PHY_INTERFACE/IF_Module_UE.h
+++ /dev/null
@@ -1,179 +0,0 @@
-
-/*This is the interface module between PHY
-*Provided the FAPI style interface structures for P7.
-*
-*
-*
-*//*
- * 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.0  (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 openair2/PHY_INTERFACE/IF_Module.h
-* \brief data structures for PHY/MAC interface modules
-* \author EURECOM/NTUST
-* \date 2017
-* \version 0.1
-* \company Eurecom
-* \email: raymond.knopp@eurecom.fr
-* \note
-* \warning
-*/
-#ifndef __IF_MODULE_UE__H__
-#define __IF_MODULE_UE__H__
-
-
-#include <stdint.h>
-#include "openair1/PHY/LTE_TRANSPORT/defs.h"
-#include "UE_MAC_interface.h"
-
-#define MAX_NUM_DL_PDU 100
-#define MAX_NUM_UL_PDU 100
-#define MAX_NUM_HI_DCI0_PDU 100
-#define MAX_NUM_TX_REQUEST_PDU 100
-
-#define MAX_NUM_HARQ_IND 100
-#define MAX_NUM_CRC_IND 100
-#define MAX_NUM_SR_IND 100
-#define MAX_NUM_CQI_IND 100
-#define MAX_NUM_RACH_IND 100
-#define MAX_NUM_SRS_IND 100
-
-typedef struct{
-  /// Module ID
-  module_id_t module_id;
-  /// CC ID
-  int CC_id;
-  // / frame
-  frame_t frame;
-  /// subframe
-  sub_frame_t subframe;
-
-  /// harq ACKs indication list
-  //UE_MAC_hi_indication_body_t UE_hi_ind;
-
-  /// crc indication list
-  //UE_MAC_crc_indication_body_t UE_crc_ind;
-
-  /// RX BCH indication
-  UE_MAC_BCH_indication_body_t UE_BCH_ind;
-
-  /// RX DLSCH indication
-  UE_MAC_DLSCH_indication_body_t UE_DLSCH_ind;
-
-} UE_DL_IND_t;
-
-
-typedef struct{
-	/// Module ID
-	module_id_t module_id;
-	/// CC ID
-	int CC_id;
-	/// frame
-	frame_t frame;
-	/// subframe
-	sub_frame_t subframe;
-	/// Txon Indication type (Msg1 or Msg3)
-	uint8_t ind_type;
-}UE_Tx_IND_t;
-
-
-typedef struct{
-	/// Module ID
-	module_id_t module_id;
-	/// CC ID
-	int CC_id;
-	/// frame
-	frame_t frame;
-	/// subframe
-	sub_frame_t subframe;
-	/// Sidelink Control Information indication
-	ue_sci_indication_body_t UE_SCI_ind;
-    /// RX SLSCH indication
-	ue_SLSCH_indication_body_t UE_SLSCH_ind;
-	/// RX SLDCH indication
-	ue_SLDCH_indication_body_t UE_SLDCH_ind;
-	/// RX SLBCH indication
-	ue_SLBCH_indication_body_t UE_SLBCH_ind;
-
-} UE_SL_IND_t;
-
-// Downlink subframe P7
-
-
-typedef struct{
-  /// Module ID
-  module_id_t module_id; 
-  /// CC ID
-  uint8_t CC_id;
-  /// frame
-  frame_t frame;
-  /// subframe
-  sub_frame_t subframe;
-  /// UE_Mode to be filled only after
-  UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_eNB_MAX];
-  /// MAC IFace UL Config Request
-  UE_MAC_ul_config_request_t *UE_UL_req;
-  /// MAC IFace SL Transmission Config Request
-  UE_MAC_sl_config_request_Tx_t *SL_Tx_req;
-  /// MAC IFace SL Reception Config Request
-  UE_MAC_sl_config_request_Rx_t *SL_Rx_req;
-  /// Pointers to UL SDUs
-  UE_MAC_tx_request_t *UE_TX_req;
-  /// Pointers to SL SDUs
-  UE_MAC_sl_tx_request_t *TX_SL_req;
-}UE_Sched_Rsp_t;
-
-typedef struct {
-    uint8_t Mod_id;
-    int CC_id;
-    UE_PHY_config_common_request_t *cfg_common;
-    UE_PHY_config_dedicated_request_t *cfg_dedicated;
-}UE_PHY_Config_t;
-
-typedef struct IF_Module_UE_s{
-//define the function pointer
-  void (*UE_DL_indication)(UE_DL_IND_t *UE_DL_INFO);
-  void (*UE_SL_indication)(UE_SL_IND_t *UE_SL_INFO);
-  void (*UE_Tx_indication)(UE_Tx_IND_t *UE_Tx_INFO);
-  void (*UE_sched_response)(UE_Sched_Rsp_t *UE_Sched_INFO);
-  void (*UE_config_req)(UE_PHY_Config_t* UE_config_INFO);
-//P: Perhaps an additional separate function for dedicated PHY configuration is needed.
-  //uint32_t CC_mask_ue;
-  uint16_t current_frame;
-  uint8_t current_subframe;
-  pthread_mutex_t if_mutex;
-}IF_Module_UE_t;
-
-
-IF_Module_UE_t *IF_Module_UE_init(int Mod_id);
-void IF_Module_UE_kill(int Mod_id);
-
-
-void UE_DL_indication(UE_DL_IND_t *UE_DL_INFO);
-
-
-void UE_Tx_indication(UE_Tx_IND_t *UE_Tx_INFO);
-
-
-/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
-void UE_schedule_response(UE_Sched_Rsp_t *UE_Sched_INFO);
-
-#endif
-
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c
index 6be951e6a6e75c024724488a49c2758f38167b6b..f24c113c175b1a07f8c19540ce7ed282685c21cc 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.c
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.c
@@ -21,6 +21,8 @@
 
 extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
 extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
+extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
+void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
 
 
 
@@ -158,9 +160,6 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
 	pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
 	UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
 
-
-
-	//LOG_I(MAC, "Panos-D: fill_rach_indication_UE_MAC 2 \n");
 	    UL_INFO->rach_ind.rach_indication_body.number_of_preambles                 = 1;
 
 	    //eNB->UL_INFO.rach_ind.preamble_list                       = &eNB->preamble_list[0];
@@ -204,7 +203,6 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
 }
 
 void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subframe, UL_IND_t *UL_INFO, uint16_t rnti) {
-	//LOG_I(MAC, "Panos-D: fill_ulsch_cqi_indication_UE_MAC 1 \n");
 
 	pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
 	nfapi_cqi_indication_pdu_t *pdu         = &UL_INFO->cqi_ind.cqi_pdu_list[UL_INFO->cqi_ind.number_of_cqis];
@@ -300,11 +298,9 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
   body->tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG;
   pdu->rx_ue_information.tl.tag                       = NFAPI_RX_UE_INFORMATION_TAG;
 
-  //LOG_I(MAC, "Panos-D: fill_uci_harq_indication_UE_MAC 2, # of harqs: %d \n", UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
   pdu->instance_length                                = 0; // don't know what to do with this
   //  pdu->rx_ue_information.handle                       = handle;
   pdu->rx_ue_information.rnti                         = rnti;
-  //LOG_I(MAC, "Panos-D: fill_uci_harq_indication_UE_MAC 3 \n");
 
   pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
 
@@ -329,7 +325,6 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
     }
     else if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) &&
                  (harq_information->harq_information_rel9_fdd.harq_size == 2)) {
-    	//LOG_I(MAC, "Panos-D: fill_uci_harq_indication_UE_MAC 6 \n");
       pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG;
       pdu->harq_indication_fdd_rel13.mode = 0;
       pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2;
@@ -384,7 +379,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
   }
 
   else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) {
-	  //LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 3 \n");
 
 	  //AssertFatal((UE_id = find_ulsch(ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
     //            "No available UE ULSCH for rnti %x\n",ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti);
@@ -411,7 +405,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
 		  }
 
 	  }
-	  //LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 3.2 \n");
 	  if(ulsch_harq_information!=NULL)
 		  fill_ulsch_harq_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, ulsch_harq_information, rnti);
 
@@ -497,7 +490,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
 
   }
   else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE) {
-	  //LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 9 \n");
     //AssertFatal((UE_id = find_uci(rel8->rnti,proc->frame_tx,proc->subframe_tx,eNB,SEARCH_EXIST_OR_FREE))>=0,
     //            "No available UE UCI for rnti %x\n",ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti);
 
@@ -541,9 +533,6 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t* req, int timer_frame, int ti
 
   for (int i=0;i<req->ul_config_request_body.number_of_pdus;i++)
   {
-    //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, ul_config_pdu_list[i].pdu_size);
-
-	//LOG_D(MAC, "Panos-D: ul_config_req_UE_MAC 2.0 #PDUs: %d \n", i<req->ul_config_request_body.number_of_pdus);
 
     if (
     		(req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE && req->ul_config_request_body.ul_config_pdu_list[i].ulsch_pdu.ulsch_pdu_rel8.rnti == UE_mac_inst[Mod_id].crnti) ||
@@ -603,18 +592,13 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
 	//if (req!=NULL && tx_request_pdu_list!=NULL){
   int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
   int sf = NFAPI_SFNSF2SF(req->sfn_sf);
-  //Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
+  //Mod_id = 0; // Currently static (only for one UE) but this should change.
 
   /*struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
   eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];*/
   nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
   nfapi_dl_config_request_pdu_t *dl_config_pdu_tmp;
 
-  /*LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[sf&1];
-
-  pdcch_vars->num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols;
-  pdcch_vars->num_dci = 0;*/
-
   //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d DCI:%d PDU:%d\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, NFAPI_SFNSF2DEC(req->sfn_sf), req->dl_config_request_body.number_dci, req->dl_config_request_body.number_pdu);
 
 
@@ -720,7 +704,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
 				i++;
 			}
 			else {
-				LOG_E(MAC,"[UE %d] %d Frame %d, subframe %d : Cannot extract DLSCH PDU from NFAPI 2\n",Mod_id, sfn, sf);
+				LOG_E(MAC,"[UE %d] Frame %d, subframe %d : Cannot extract DLSCH PDU from NFAPI 2\n",Mod_id, sfn, sf);
 				i++;
 			}
 
@@ -747,34 +731,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
       //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type);
     }
   }
-  //deallocate_mem_nfapi_dl
 
-  /*if(req->vendor_extension)
-    free(req->vendor_extension);
-
-
-  if(req->dl_config_request_body.dl_config_pdu_list!=NULL){
-	  free(req->dl_config_request_body.dl_config_pdu_list);
-	  req->dl_config_request_body.dl_config_pdu_list = NULL;
-  }
-  free(req);
-  req = NULL;*/
   return 0;
-	/*}
-	else if(req!=NULL){
-		//LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC probably dummy DL_Config \n");
-		if(req->dl_config_request_body.dl_config_pdu_list!=NULL){
-			//LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC probably dummy DL_Config 2\n");
-			free(req->dl_config_request_body.dl_config_pdu_list);
-			req->dl_config_request_body.dl_config_pdu_list = NULL;
-		}
-		free(req);
-		req = NULL;
-		return -1;
-	}*/
-
-
-
 
 }
 
@@ -829,12 +787,10 @@ int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req, module_id_t Mod_id)
 // pnf_p7_subframe_ind.
 int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req)
 {
-	//LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1");
-
 
-	module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
+	//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
 
-	for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
+	//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
 
 	dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t));
 	//LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1, Mod_id:%d \n", Mod_id);
@@ -858,7 +814,7 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
 		dl_config_req->dl_config_request_body.dl_config_pdu_list[i] = req->dl_config_request_body.dl_config_pdu_list[i];
 	}
 
-	}
+	//}
 
 	return 0;
 
@@ -868,10 +824,10 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
 {
 	//LOG_D(MAC, "Panos-D: memcpy_ul_config_req 1 \n");
 
-	module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
+	//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
 
 
-	for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
+	//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
 
 		ul_config_req = (nfapi_ul_config_request_t*)malloc(sizeof(nfapi_ul_config_request_t));
 
@@ -891,7 +847,7 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
 	for(int i=0; i<ul_config_req->ul_config_request_body.number_of_pdus; i++) {
 			ul_config_req->ul_config_request_body.ul_config_pdu_list[i] = req->ul_config_request_body.ul_config_pdu_list[i];
 		}
-	}
+	//}
 
 	return 0;
 }
@@ -901,7 +857,7 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
 
 int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
 {
-	module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
+	//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
 
 
 	tx_req_num_elems = req->tx_request_body.number_of_pdus;
@@ -928,9 +884,9 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
 {
 
 	//if(req!=0){
-	module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
+	//module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
 
-	for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
+	//for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){
 	hi_dci0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
 
 	hi_dci0_req->sfn_sf = req->sfn_sf;
@@ -953,7 +909,7 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
 		//LOG_I(MAC, "Original hi_dci0 req. type:%d, Copy type: %d \n",req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type, UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
 	}
 
-	}
+	//}
 		return 0;
 }
 
@@ -1057,7 +1013,7 @@ uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn) { return(0);}
 int32_t get_uldl_offset(int eutra_bandP) { return(0);}
 
 int l1_north_init_eNB() {
-
+return 0;
 }
 
 void init_eNB_afterRU(void) {
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index c0bf44a2dfb6258d2f83d2f8d78a5e46393049c1..508935c9e4e3de35c42637f839740845f9954700 100644
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -287,7 +287,7 @@ uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
    if (in_coverage > 0 ){
       //in coverage
       mib_sl->inCoverage_r12 = TRUE;
-      mib_sl->sl_Bandwidth_r12 = UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth;
+      mib_sl->sl_Bandwidth_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth;
       if (UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config) {
          mib_sl->tdd_ConfigSL_r12.subframeAssignmentSL_r12 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config->subframeAssignment;
       } else {
@@ -570,9 +570,9 @@ uint8_t do_SIB23(uint8_t Mod_id,
   struct SL_CommResourcePool_r12 *SL_CommResourcePool; //for SIB18
   SL_DiscRxPoolList_r12_t *SL_DiscRxPoolList; //for SIB19 (discRxPool)
   struct SL_DiscResourcePool_r12 *SL_DiscResourcePool; //for SIB19 (discRxPool)
-  SL_DiscRxPoolList_r12_t *SL_DiscRxPoolPSList; //for SIB19 (discRxPoolPS)
-  struct SL_DiscResourcePool_r12 *SL_DiscResourcePoolPS; //for SIB19 (discRxPoolPS)
-  struct SL_V2X_ConfigCommon_r14 *SL_V2X_ConfigCommon;
+  //SL_DiscRxPoolList_r12_t *SL_DiscRxPoolPSList; //for SIB19 (discRxPoolPS)
+  //struct SL_DiscResourcePool_r12 *SL_DiscResourcePoolPS; //for SIB19 (discRxPoolPS)
+  //struct SL_V2X_ConfigCommon_r14 *SL_V2X_ConfigCommon;
 #endif
 
 #if defined(Rel10) || defined(Rel14)
@@ -1087,37 +1087,37 @@ uint8_t do_SIB23(uint8_t Mod_id,
   if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){
      //for BS4
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){
      //for BS8
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){
      //for BS12
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){
      //for BS16
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){
      //for BS30
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){
      //for BS40
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){
      //for BS42
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf  = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf  = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }
 
@@ -1196,37 +1196,37 @@ uint8_t do_SIB23(uint8_t Mod_id,
   if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){
      //for BS4
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf  =  configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf  =  (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){
      //for BS8
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){
      //for BS12
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){
      //for BS16
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){
      //for BS30
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){
      //for BS40
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){
      //for BS42
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
-     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf  = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+     SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf  = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
      SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
   }
 
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index 5d0a5b47e005a23ff48bd2464c380832ab7256c3..e907f1a8f9e0756be97f131e87262606e768975b 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -30,6 +30,7 @@
 
 #define RRC_UE
 #define RRC_UE_C
+#define _GNU_SOURCE
 
 #include "assertions.h"
 #include "hashtable.h"
@@ -3869,12 +3870,12 @@ uint64_t arfcn_to_freq(long arfcn) {
    LOG_I( RRC, "[UE] Dumping SIB18\n" );
    for (int i = 0; i < sib18->commConfig_r12->commRxPool_r12.list.count; i++) {
        LOG_I(RRC, " Contents of SIB18 %d/%d \n", i+1, sib18->commConfig_r12->commRxPool_r12.list.count);
-       LOG_I(RRC, " SIB18 rxPool_sc_CP_Len: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_CP_Len_r12);
-       LOG_I(RRC, " SIB18 sc_Period_r12: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_Period_r12);
-       LOG_I(RRC, " SIB18 data_CP_Len_r12: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->data_CP_Len_r12);
-       LOG_I(RRC, " SIB18 prb_Num_r12: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Num_r12);
-       LOG_I(RRC, " SIB18 prb_Start_r12: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Start_r12);
-       LOG_I(RRC, " SIB18 prb_End_r12: %d \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_End_r12);
+       LOG_I(RRC, " SIB18 rxPool_sc_CP_Len: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_CP_Len_r12);
+       LOG_I(RRC, " SIB18 sc_Period_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_Period_r12);
+       LOG_I(RRC, " SIB18 data_CP_Len_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->data_CP_Len_r12);
+       LOG_I(RRC, " SIB18 prb_Num_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Num_r12);
+       LOG_I(RRC, " SIB18 prb_Start_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Start_r12);
+       LOG_I(RRC, " SIB18 prb_End_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_End_r12);
        //to add more log
      }
 }
@@ -3885,13 +3886,13 @@ uint64_t arfcn_to_freq(long arfcn) {
    LOG_I( RRC, "[UE] Dumping SIB19\n" );
    for (int i = 0; i < sib19->discConfig_r12->discRxPool_r12.list.count; i++) {
        LOG_I(RRC, " Contents of SIB19 %d/%d \n", i+1, sib19->discConfig_r12->discRxPool_r12.list.count);
-       LOG_I(RRC, " SIB19 cp_Len_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->cp_Len_r12);
-       LOG_I(RRC, " SIB19 discPeriod_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->discPeriod_r12);
-       LOG_I(RRC, " SIB19 numRetx_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRetx_r12);
-       LOG_I(RRC, " SIB19 numRepetition_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRepetition_r12);
-       LOG_I(RRC, " SIB19 prb_Num_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Num_r12);
-       LOG_I(RRC, " SIB19 prb_Start_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Start_r12);
-       LOG_I(RRC, " SIB19 prb_End_r12: %d \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_End_r12);
+       LOG_I(RRC, " SIB19 cp_Len_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->cp_Len_r12);
+       LOG_I(RRC, " SIB19 discPeriod_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->discPeriod_r12);
+       LOG_I(RRC, " SIB19 numRetx_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRetx_r12);
+       LOG_I(RRC, " SIB19 numRepetition_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRepetition_r12);
+       LOG_I(RRC, " SIB19 prb_Num_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Num_r12);
+       LOG_I(RRC, " SIB19 prb_Start_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Start_r12);
+       LOG_I(RRC, " SIB19 prb_End_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_End_r12);
        //to add more log
      }
 }
@@ -3902,9 +3903,9 @@ uint64_t arfcn_to_freq(long arfcn) {
           LOG_I(RRC, " Contents of SIB21 %d/%d \n", i+1, sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count);
           LOG_I(RRC, " SIB21 sl_Subframe_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sl_Subframe_r14.present);
           LOG_I(RRC, " SIB21 adjacencyPSCCH_PSSCH_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->adjacencyPSCCH_PSSCH_r14);
-          LOG_I(RRC, " SIB21 sizeSubchannel_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sizeSubchannel_r14);
-          LOG_I(RRC, " SIB21 numSubchannel_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->numSubchannel_r14);
-          LOG_I(RRC, " SIB21 startRB_Subchannel_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->startRB_Subchannel_r14);
+          LOG_I(RRC, " SIB21 sizeSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sizeSubchannel_r14);
+          LOG_I(RRC, " SIB21 numSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->numSubchannel_r14);
+          LOG_I(RRC, " SIB21 startRB_Subchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->startRB_Subchannel_r14);
           //to add more log
        }
     }
@@ -5297,7 +5298,7 @@ rrc_top_cleanup_ue(
 //-----------------------------------------------------------------------------
 uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,SL_DestinationInfoList_r12_t  *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode)
 {
-   uint8_t    size;
+   uint8_t    size=0;
    uint8_t buffer[100];
 
    //Generate SidelinkUEInformation
@@ -5346,7 +5347,7 @@ uint8_t fill_SLSS(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
          //if RRC_CONNECTED (Todo: and if networkControlledSyncTx (RRCConnectionReconfiguration) is configured and set to On)
          if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_CONNECTED){
             //select subframe(s) indicated by syncOffsetIndicator
-            subframe = syncOffsetIndicator;
+            *subframe = syncOffsetIndicator;
          } else {
             //select subframe(s) indicated by syncOffsetIndicator within SC period
          }
@@ -5429,9 +5430,9 @@ rrc_ue_process_sidelink_radioResourceConfig(
                      Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size );
                LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI buf 0x%08x \n",
                      Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf );
-               LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, Mac_MainConfig_r12.retx_BSR_TimerSL %d \n",
+               LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, Mac_MainConfig_r12.retx_BSR_TimerSL %ld \n",
                      Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
-               LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sc_CommTxConfig %d \n",
+               LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sc_CommTxConfig %ld \n",
                      Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
                //configure scheduled resource for SL
                //TODO
@@ -5522,7 +5523,7 @@ rrc_control_socket_init(){
    pthread_attr_t     attr;
    struct sched_param sched_param;
    int optval; // flag value for setsockopt
-   int n; // message byte size
+   //int n; // message byte size
 
 
    // create the control socket
@@ -5579,7 +5580,7 @@ void *rrc_control_socket_thread_fct(void *arg)
    int prose_addr_len;
    char send_buf[BUFSIZE];
    char receive_buf[BUFSIZE];
-   int optval;
+   //int optval;
    int n;
    struct sidelink_ctrl_element *sl_ctrl_msg_recv = NULL;
    struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
@@ -5599,13 +5600,13 @@ void *rrc_control_socket_thread_fct(void *arg)
 
    //from the main program, listen for the incoming messages from control socket (ProSe App)
    prose_addr_len = sizeof(prose_app_addr);
-   int enable_notification = 1;
+   //int enable_notification = 1;
    while (1) {
       LOG_I(RRC,"Listening to incoming connection from ProSe App \n");
       // receive a message from ProSe App
       memset(receive_buf, 0, BUFSIZE);
       n = recvfrom(ctrl_sock_fd, receive_buf, BUFSIZE, 0,
-            (struct sockaddr *) &prose_app_addr, &prose_addr_len);
+            (struct sockaddr *) &prose_app_addr, (socklen_t *)&prose_addr_len);
       if (n < 0){
          LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
          exit(EXIT_FAILURE);
diff --git a/targets/RT/USER/lte-softmodem-stub.c b/targets/RT/USER/lte-softmodem-stub.c
deleted file mode 100644
index 1bc3bab6b1861fd0998912386cbbb902626aae90..0000000000000000000000000000000000000000
--- a/targets/RT/USER/lte-softmodem-stub.c
+++ /dev/null
@@ -1,1550 +0,0 @@
-/*
- * lte-softmodem-stub.c
- *
- *  Created on: Nov 27, 2017
- *      Author: montre
- */
-
-
-/*
- * 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 lte-enb.c
- * \brief Top-level threads for eNodeB
- * \author R. Knopp, F. Kaltenberger, Navid Nikaein
- * \date 2012
- * \version 0.1
- * \company Eurecom
- * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
- * \note
- * \warning
- */
-
-
-#define _GNU_SOURCE             /* See feature_test_macros(7) */
-#include <sched.h>
-
-
-#include "T.h"
-
-#include "rt_wrapper.h"
-
-
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#include "assertions.h"
-#include "msc.h"
-
-#include "PHY/types.h"
-
-#include "PHY/defs.h"
-#include "common/ran_context.h"
-#include "common/config/config_userapi.h"
-#include "common/utils/load_module_shlib.h"
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#include "../../ARCH/COMMON/common_lib.h"
-#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
-
-//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#include "PHY/vars.h"
-#include "SCHED/vars.h"
-#include "LAYER2/MAC/vars.h"
-
-#include "../../SIMU/USER/init_lte.h"
-
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "LAYER2/MAC/proto.h"
-#include "RRC/LITE/vars.h"
-#include "PHY_INTERFACE/vars.h"
-
-#ifdef SMBV
-#include "PHY/TOOLS/smbv.h"
-unsigned short config_frames[4] = {2,9,11,13};
-#endif
-#include "UTIL/LOG/log_extern.h"
-#include "UTIL/OTG/otg_tx.h"
-#include "UTIL/OTG/otg_externs.h"
-#include "UTIL/MATH/oml.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "UTIL/OPT/opt.h"
-#include "enb_config.h"
-#include "targets/COMMON/create_tasks.h"
-//#include "PHY/TOOLS/time_meas.h"
-
-#ifndef OPENAIR2
-#include "UTIL/OTG/otg_vars.h"
-#endif
-
-#define D2D_MODE
-
-#if defined(ENABLE_ITTI)
-#include "intertask_interface_init.h"
-#include "create_tasks.h"
-#endif
-
-#include "system.h"
-
-static char *in_ip_xx = in_ip;
-
-#ifdef XFORMS
-#include "PHY/TOOLS/lte_phy_scope.h"
-#include "stats.h"
-#endif
-#include "lte-softmodem.h"
-
-#ifdef XFORMS
-// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
-// at eNB 0, an UL scope for every UE
-FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
-FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-FD_stats_form                  *form_stats=NULL,*form_stats_l2=NULL;
-char title[255];
-unsigned char                   scope_enb_num_ue = 2;
-static pthread_t                forms_thread; //xforms
-#endif //XFORMS
-
-pthread_cond_t nfapi_sync_cond;
-pthread_mutex_t nfapi_sync_mutex;
-int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
-
-uint8_t nfapi_mode = 0;
-
-uint16_t sf_ahead=2;
-
-char *emul_iface;
-
-pthread_cond_t sync_cond;
-pthread_mutex_t sync_mutex;
-int sync_var=-1; //!< protected by mutex \ref sync_mutex.
-int config_sync_var=-1;
-
-uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
-uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
-
-#if defined(ENABLE_ITTI)
-volatile int             start_eNB = 0;
-volatile int             start_UE = 0;
-#endif
-volatile int             oai_exit = 0;
-
-static clock_source_t clock_source = internal;
-static int wait_for_sync = 0;
-
-static char              UE_flag=0;
-unsigned int                    mmapped_dma=0;
-int                             single_thread_flag=1;
-
-static char                     threequarter_fs=0;
-
-uint32_t                 downlink_frequency[MAX_NUM_CCs][4];
-int32_t                  uplink_frequency_offset[MAX_NUM_CCs][4];
-
-
-
-#if defined(ENABLE_ITTI)
-static char                    *itti_dump_file = NULL;
-#endif
-
-int UE_scan = 1;
-int UE_scan_carrier = 0;
-runmode_t mode = normal_txrx;
-
-FILE *input_fd=NULL;
-
-
-#if MAX_NUM_CCs == 1
-rx_gain_t                rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
-double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
-double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0}};
-#else
-rx_gain_t                rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain},{max_gain,max_gain,max_gain,max_gain}};
-double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0},{20,0,0,0}};
-double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
-#endif
-
-double rx_gain_off = 0.0;
-
-double sample_rate=30.72e6;
-double bw = 10.0e6;
-
-static int                      tx_max_power[MAX_NUM_CCs]; /* =  {0,0}*/;
-
-char   rf_config_file[1024];
-
-int chain_offset=0;
-int phy_test = 0;
-uint8_t usim_test = 0;
-
-uint8_t dci_Format = 0;
-uint8_t agregation_Level =0xFF;
-
-uint8_t nb_antenna_tx = 1;
-uint8_t nb_antenna_rx = 1;
-
-char ref[128] = "internal";
-char channels[128] = "0";
-
-int                      rx_input_level_dBm;
-
-#ifdef XFORMS
-extern int                      otg_enabled;
-static char                     do_forms=0;
-#else
-int                             otg_enabled;
-#endif
-//int                             number_of_cards =   1;
-
-
-static LTE_DL_FRAME_PARMS      *frame_parms[MAX_NUM_CCs];
-uint32_t target_dl_mcs = 28; //maximum allowed mcs
-uint32_t target_ul_mcs = 20;
-uint32_t timing_advance = 0;
-uint8_t exit_missed_slots=1;
-uint64_t num_missed_slots=0; // counter for the number of missed slots
-
-
-extern void reset_opp_meas(void);
-extern void print_opp_meas(void);
-
-extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
-			  uint8_t UE_id,
-			  uint8_t abstraction_flag);
-
-extern void init_eNB_afterRU(void);
-extern void init_UE_stub(int nb_inst,int,int,char*);
-extern int init_timer_thread(void);
-
-int transmission_mode=1;
-
-
-
-/* struct for ethernet specific parameters given in eNB conf file */
-eth_params_t *eth_params;
-
-openair0_config_t openair0_cfg[MAX_CARDS];
-
-double cpuf;
-
-extern char uecap_xer[1024];
-char uecap_xer_in=0;
-
-int oaisim_flag=0;
-threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
-
-/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
- * this is very hackish - find a proper solution
- */
-uint8_t abstraction_flag=0;
-
-/*---------------------BMC: timespec helpers -----------------------------*/
-
-struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
-struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
-
-struct timespec clock_difftime(struct timespec start, struct timespec end) {
-  struct timespec temp;
-  if ((end.tv_nsec-start.tv_nsec)<0) {
-    temp.tv_sec = end.tv_sec-start.tv_sec-1;
-    temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
-  } else {
-    temp.tv_sec = end.tv_sec-start.tv_sec;
-    temp.tv_nsec = end.tv_nsec-start.tv_nsec;
-  }
-  return temp;
-}
-
-void print_difftimes(void) {
-#ifdef DEBUG
-  printf("difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
-#else
-  LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
-#endif
-}
-
-void update_difftimes(struct timespec start, struct timespec end) {
-  struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 };
-  int             changed = 0;
-  diff_time = clock_difftime(start, end);
-  if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) {
-    min_diff_time.tv_nsec = diff_time.tv_nsec;
-    changed = 1;
-  }
-  if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) {
-    max_diff_time.tv_nsec = diff_time.tv_nsec;
-    changed = 1;
-  }
-#if 1
-  if (changed) print_difftimes();
-#endif
-}
-
-/*------------------------------------------------------------------------*/
-
-unsigned int build_rflocal(int txi, int txq, int rxi, int rxq) {
-  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
-}
-unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) {
-  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
-}
-
-#if !defined(ENABLE_ITTI)
-void signal_handler(int sig) {
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    printf("trying to exit gracefully...\n");
-    oai_exit = 1;
-  }
-}
-#endif
-#define KNRM  "\x1B[0m"
-#define KRED  "\x1B[31m"
-#define KGRN  "\x1B[32m"
-#define KBLU  "\x1B[34m"
-#define RESET "\033[0m"
-
-
-
-void exit_fun(const char* s)
-{
-  int CC_id;
-  int ru_id;
-
-  if (s != NULL) {
-    printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
-  }
-
-  oai_exit = 1;
-
-  if (UE_flag==0) {
-    for (ru_id=0; ru_id<RC.nb_RU;ru_id++) {
-      if (RC.ru[ru_id]->rfdevice.trx_end_func)
-	RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
-      if (RC.ru[ru_id]->ifdevice.trx_end_func)
-	RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
-    }
-  }
-
-  for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    oai_exit = 1;
-
-    for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      if (UE_flag == 0) {
-      } else {
-	if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func)
-	  PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
-      }
-    }
-
-#if defined(ENABLE_ITTI)
-    sleep(1); //allow lte-softmodem threads to exit first
-    itti_terminate_tasks (TASK_UNKNOWN);
-#endif
-
-  }
-
-}
-
-#ifdef XFORMS
-
-
-void reset_stats(FL_OBJECT *button, long arg)
-{
-  int i,j,k;
-  PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0];
-
-  for (i=0; i<NUMBER_OF_UE_MAX; i++) {
-    for (k=0; k<8; k++) { //harq_processes
-      for (j=0; j<phy_vars_eNB->dlsch[i][0]->Mlimit; j++) {
-	phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0;
-	phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0;
-	phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0;
-      }
-
-      phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0;
-      phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0;
-      phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0;
-
-
-      phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0;
-      phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0;
-      phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0;
-    }
-  }
-}
-
-static void *scope_thread(void *arg) {
-  char stats_buffer[16384];
-# ifdef ENABLE_XFORMS_WRITE_STATS
-  FILE *UE_stats, *eNB_stats;
-# endif
-  struct sched_param sched_param;
-  int UE_id, CC_id;
-  int ue_cnt=0;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("Scope thread has priority %d\n",sched_param.sched_priority);
-
-# ifdef ENABLE_XFORMS_WRITE_STATS
-
-  if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-  else
-    eNB_stats = fopen("eNB_stats.txt", "w");
-
-#endif
-
-  while (!oai_exit) {
-    if (UE_flag==1) {
-      dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
-      //fl_set_object_label(form_stats->stats_text, stats_buffer);
-      fl_clear_browser(form_stats->stats_text);
-      fl_add_browser_line(form_stats->stats_text, stats_buffer);
-
-      phy_scope_UE(form_ue[0],
-		   PHY_vars_UE_g[0][0],
-		   0,
-		   0,7);
-
-
-    } else {
-      /*
-	if (RC.eNB[0][0]->mac_enabled==1) {
-	len = dump_eNB_l2_stats (stats_buffer, 0);
-	//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
-	fl_clear_browser(form_stats_l2->stats_text);
-	fl_add_browser_line(form_stats_l2->stats_text, stats_buffer);
-	}
-	len = dump_eNB_stats (RC.eNB[0][0], stats_buffer, 0);
-
-	if (MAX_NUM_CCs>1)
-	len += dump_eNB_stats (RC.eNB[0][1], &stats_buffer[len], 0);
-
-	//fl_set_object_label(form_stats->stats_text, stats_buffer);
-	fl_clear_browser(form_stats->stats_text);
-	fl_add_browser_line(form_stats->stats_text, stats_buffer);
-      */
-      ue_cnt=0;
-      for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
-	for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-	  //	  if ((RC.eNB[0][CC_id]->dlsch[UE_id][0]->rnti>0) && (ue_cnt<scope_enb_num_ue)) {
-	  if ((ue_cnt<scope_enb_num_ue)) {
-	    phy_scope_eNB(form_enb[CC_id][ue_cnt],
-			  RC.eNB[0][CC_id],
-			  UE_id);
-	    ue_cnt++;
-	  }
-	}
-      }
-
-    }
-
-    //printf("doing forms\n");
-    //usleep(100000); // 100 ms
-    sleep(1);
-  }
-
-  //  printf("%s",stats_buffer);
-
-# ifdef ENABLE_XFORMS_WRITE_STATS
-
-  if (UE_flag==1) {
-    if (UE_stats) {
-      rewind (UE_stats);
-      fwrite (stats_buffer, 1, len, UE_stats);
-      fclose (UE_stats);
-    }
-  } else {
-    if (eNB_stats) {
-      rewind (eNB_stats);
-      fwrite (stats_buffer, 1, len, eNB_stats);
-      fclose (eNB_stats);
-    }
-  }
-
-# endif
-
-  pthread_exit((void*)arg);
-}
-#endif
-
-
-
-
-#if defined(ENABLE_ITTI)
-void *l2l1_task(void *arg) {
-  MessageDef *message_p = NULL;
-  int         result;
-
-  itti_set_task_real_time(TASK_L2L1);
-  itti_mark_task_ready(TASK_L2L1);
-
-  if (UE_flag == 0) {
-    /* Wait for the initialize message */
-    printf("Wait for the ITTI initialize message\n");
-    do {
-      if (message_p != NULL) {
-	result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-	AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-      }
-
-      itti_receive_msg (TASK_L2L1, &message_p);
-
-      switch (ITTI_MSG_ID(message_p)) {
-      case INITIALIZE_MESSAGE:
-	/* Start eNB thread */
-	LOG_D(EMU, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
-	start_eNB = 1;
-	break;
-
-      case TERMINATE_MESSAGE:
-	printf("received terminate message\n");
-	oai_exit=1;
-	itti_exit_task ();
-	break;
-
-      default:
-	LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
-	break;
-      }
-    } while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
-
-    result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-    AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-  }
-
-  do {
-    // Wait for a message
-    itti_receive_msg (TASK_L2L1, &message_p);
-
-    switch (ITTI_MSG_ID(message_p)) {
-    case TERMINATE_MESSAGE:
-      oai_exit=1;
-      itti_exit_task ();
-      break;
-
-    case ACTIVATE_MESSAGE:
-      start_UE = 1;
-      break;
-
-    case DEACTIVATE_MESSAGE:
-      start_UE = 0;
-      break;
-
-    case MESSAGE_TEST:
-      LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
-      break;
-
-    default:
-      LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
-      break;
-    }
-
-    result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
-    AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-  } while(!oai_exit);
-
-  return NULL;
-}
-#endif
-
-void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
-void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
-
-  int CC_id;
-  printf("Panos: set_default_frame_parms1 %d \n",MAX_NUM_CCs);
-
-  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
-    /* Set some default values that may be overwritten while reading options */
-    frame_parms[CC_id]->frame_type          = FDD;
-    frame_parms[CC_id]->tdd_config          = 3;
-    frame_parms[CC_id]->tdd_config_S        = 0;
-    frame_parms[CC_id]->N_RB_DL             = 100;
-
-    frame_parms[CC_id]->N_RB_UL             = 100;
-    frame_parms[CC_id]->Ncp                 = NORMAL;
-    frame_parms[CC_id]->Ncp_UL              = NORMAL;
-    frame_parms[CC_id]->Nid_cell            = 0;
-    frame_parms[CC_id]->num_MBSFN_config    = 0;
-    frame_parms[CC_id]->nb_antenna_ports_eNB  = 1;
-    frame_parms[CC_id]->nb_antennas_tx      = 1;
-    frame_parms[CC_id]->nb_antennas_rx      = 1;
-
-    frame_parms[CC_id]->nushift             = 0;
-
-    frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth;
-    frame_parms[CC_id]->phich_config_common.phich_duration = normal;
-    // UL RS Config
-    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
-    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0;
-    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0;
-    frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
-
-    frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22;
-    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1;
-    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0;
-    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
-    frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
-
-    downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
-    downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
-    downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
-    downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
-    //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
-
-  }
-
-}
-
-
-static void get_options(void) {
-  int CC_id;
-  int tddflag;
-  char *loopfile=NULL;
-  int dumpframe;
-  uint32_t online_log_messages;
-  uint32_t glog_level, glog_verbosity;
-  uint32_t start_telnetsrv;
-
-  paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
-  paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
-
-
-  config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
-  printf("get_options 0, UE_flag: %d", UE_flag);
-
-  if (strlen(in_path) > 0) {
-      opt_type = OPT_PCAP;
-      opt_enabled=1;
-      printf("Enabling OPT for PCAP  with the following file %s \n",in_path);
-  }
-  if (strlen(in_ip) > 0) {
-      opt_enabled=1;
-      opt_type = OPT_WIRESHARK;
-      printf("Enabling OPT for wireshark for local interface");
-  }
-  config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
-  if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
-      set_glog_onlinelog(online_log_messages);
-  }
-  if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
-      set_glog(glog_level, -1);
-  }
-  if(config_isparamset(cmdline_logparams,CMDLINE_GLOGVERBO_IDX)) {
-      set_glog(-1, glog_verbosity);
-  }
-  if (start_telnetsrv) {
-     load_module_shlib("telnetsrv",NULL,0);
-  }
-
-  if (UE_flag > 0) {
-
-     uint8_t n_rb_dl;
-
-     paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
-     paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC; 
-
-     set_default_frame_parms(frame_parms);
-
-     emul_iface=malloc(100);
-
-     config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
-     config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
-
-
-      if (loopfile != NULL) {
-  	  printf("Input file for hardware emulation: %s",loopfile);
-  	  mode=loop_through_memory;
-  	  input_fd = fopen(loopfile,"r");
-  	  AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
-      }
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
-      printf("Panos: get_options 9 \n");
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
-      printf("Panos: get_options 10 \n");
-      if ( (cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = debug_prach;
-      if ( (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0)  mode = no_L2_connect;
-      if ( (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].paramflags &  PARAMFLAG_PARAMSET) != 0) mode = calib_prach_tx; 
-      printf("Panos: get_options 11 \n");
-      if (dumpframe  > 0)  mode = rx_dump_frame;
-      if ( downlink_frequency[0][0] > 0) {
-        printf("Downlink frequency set to %u\n", downlink_frequency[0][0]);
-        for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-          frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
-        }
-        UE_scan=0;
-      } 
-      
-      if (tddflag > 0) {
-	for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) 
-	  frame_parms[CC_id]->frame_type = TDD;
-      }
-      
-      if (n_rb_dl !=0) {
-        printf("NB_RB set to %d\n",n_rb_dl);
-        if ( n_rb_dl < 6 ) {
-          n_rb_dl = 6;
-          printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",n_rb_dl);
-        }
-        if ( n_rb_dl > 100 ) {
-          n_rb_dl = 100;
-          printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",n_rb_dl);
-        }
-        if ( n_rb_dl > 50 && n_rb_dl < 100 ) {
-          n_rb_dl = 50;
-          printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",n_rb_dl);
-        }
-        if ( n_rb_dl > 25 && n_rb_dl < 50 ) {
-          n_rb_dl = 25;
-          printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",n_rb_dl);
-        }
-        UE_scan = 0;
-        for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-          frame_parms[CC_id]->N_RB_DL=n_rb_dl;
-          frame_parms[CC_id]->N_RB_UL=n_rb_dl;
-        }
-      }
-      
-      
-      for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++) {
-  	    tx_max_power[CC_id]=tx_max_power[0];
-	    rx_gain[0][CC_id] = rx_gain[0][0];
-	    tx_gain[0][CC_id] = tx_gain[0][0];
-      }
-      printf("Emulation interface : %s (%p,%p)\n",emul_iface,emul_iface,&emul_iface);
-  } /* UE_flag > 0 */
-#if T_TRACER
-  paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
-  config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);
-#endif
-
-  if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
-    if (UE_flag == 0) {
-      memset((void*)&RC,0,sizeof(RC));
-      /* Read RC configuration file */
-      RCConfig();
-      NB_eNB_INST = RC.nb_inst;
-      NB_RU	  = RC.nb_RU;
-      printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,NB_RU);
-    }
-  } else if (UE_flag == 1 && (CONFIG_GETCONFFILE != NULL)) {
-    // Here the configuration file is the XER encoded UE capabilities
-    // Read it in and store in asn1c data structures
-    strcpy(uecap_xer,CONFIG_GETCONFFILE);
-    uecap_xer_in=0;
-    printf("Panos: get_options 7 \n");
-  } /* UE with config file  */
-}
-
-
-#if T_TRACER
-int T_nowait = 0;     /* by default we wait for the tracer */
-int T_port = 2021;    /* default port to listen to to wait for the tracer */
-int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
-#endif
-
-
-
-void init_openair0(void);
-
-void init_openair0() {
-
-  int card;
-  int i;
-
-  for (card=0; card<MAX_CARDS; card++) {
-
-    openair0_cfg[card].mmapped_dma=mmapped_dma;
-    openair0_cfg[card].configFilename = NULL;
-
-    if(frame_parms[0]->N_RB_DL == 100) {
-      if (frame_parms[0]->threequarter_fs) {
-	openair0_cfg[card].sample_rate=23.04e6;
-	openair0_cfg[card].samples_per_frame = 230400;
-	openair0_cfg[card].tx_bw = 10e6;
-	openair0_cfg[card].rx_bw = 10e6;
-      } else {
-	openair0_cfg[card].sample_rate=30.72e6;
-	openair0_cfg[card].samples_per_frame = 307200;
-	openair0_cfg[card].tx_bw = 10e6;
-	openair0_cfg[card].rx_bw = 10e6;
-      }
-    } else if(frame_parms[0]->N_RB_DL == 50) {
-      openair0_cfg[card].sample_rate=15.36e6;
-      openair0_cfg[card].samples_per_frame = 153600;
-      openair0_cfg[card].tx_bw = 5e6;
-      openair0_cfg[card].rx_bw = 5e6;
-    } else if (frame_parms[0]->N_RB_DL == 25) {
-      openair0_cfg[card].sample_rate=7.68e6;
-      openair0_cfg[card].samples_per_frame = 76800;
-      openair0_cfg[card].tx_bw = 2.5e6;
-      openair0_cfg[card].rx_bw = 2.5e6;
-    } else if (frame_parms[0]->N_RB_DL == 6) {
-      openair0_cfg[card].sample_rate=1.92e6;
-      openair0_cfg[card].samples_per_frame = 19200;
-      openair0_cfg[card].tx_bw = 1.5e6;
-      openair0_cfg[card].rx_bw = 1.5e6;
-    }
-
-
-
-
-    if (frame_parms[0]->frame_type==TDD)
-      openair0_cfg[card].duplex_mode = duplex_mode_TDD;
-    else //FDD
-      openair0_cfg[card].duplex_mode = duplex_mode_FDD;
-
-    printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
-	   ((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx),
-	   ((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
-    openair0_cfg[card].Mod_id = 0;
-
-    openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
-
-    openair0_cfg[card].clock_source = clock_source;
-
-
-    openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx));
-    openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
-
-    for (i=0; i<4; i++) {
-
-      if (i<openair0_cfg[card].tx_num_channels)
-	openair0_cfg[card].tx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] : downlink_frequency[0][i]+uplink_frequency_offset[0][i];
-      else
-	openair0_cfg[card].tx_freq[i]=0.0;
-
-      if (i<openair0_cfg[card].rx_num_channels)
-	openair0_cfg[card].rx_freq[i] = (UE_flag==0) ? downlink_frequency[0][i] + uplink_frequency_offset[0][i] : downlink_frequency[0][i];
-      else
-	openair0_cfg[card].rx_freq[i]=0.0;
-
-      openair0_cfg[card].autocal[i] = 1;
-      openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
-      if (UE_flag == 0) {
-	openair0_cfg[card].rx_gain[i] = RC.eNB[0][0]->rx_total_gain_dB;
-      }
-      else {
-	openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
-      }
-
-      openair0_cfg[card].configFilename = rf_config_file;
-      printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
-	     card,i, openair0_cfg[card].tx_gain[i],
-	     openair0_cfg[card].rx_gain[i],
-	     openair0_cfg[card].tx_freq[i],
-	     openair0_cfg[card].rx_freq[i]);
-    }
-  }
-}
-
-
-void wait_RUs(void) {
-
-  LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
-
-  // wait for all RUs to be configured over fronthaul
-  pthread_mutex_lock(&RC.ru_mutex);
-
-
-
-  while (RC.ru_mask>0) {
-    pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
-    printf("RC.ru_mask:%02lx\n", RC.ru_mask);
-  }
-
-  LOG_I(PHY,"RUs configured\n");
-}
-
-void wait_eNBs(void) {
-
-  int i,j;
-  int waiting=1;
-
-
-  while (waiting==1) {
-    printf("Waiting for eNB L1 instances to all get configured ... sleeping 500ms (nb_L1_inst %d)\n",RC.nb_L1_inst);
-    usleep(5000000);
-    waiting=0;
-    for (i=0;i<RC.nb_L1_inst;i++) {
-
-      printf("RC.nb_L1_CC[%d]:%d\n", i, RC.nb_L1_CC[i]);
-
-      for (j=0;j<RC.nb_L1_CC[i];j++) {
-	if (RC.eNB[i][j]->configured==0) {
-	  waiting=1;
-	  break;
-        }
-      }
-    }
-  }
-  printf("eNB L1 are configured\n");
-}
-
-static inline void wait_nfapi_init(char *thread_name) {
-
-  printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
-  pthread_mutex_lock( &nfapi_sync_mutex );
-
-  while (nfapi_sync_var<0)
-    pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex );
-
-  pthread_mutex_unlock(&nfapi_sync_mutex);
-
-  printf( "NFAPI: got sync (%s)\n", thread_name);
-}
-
-int main( int argc, char **argv )
-{
-  int i;
-#if defined (XFORMS)
-  void *status;
-#endif
-
-  int CC_id;
-  int ru_id;
-  uint8_t  abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
-  // Default value for the number of UEs. It will hold,
-  // if not changed from the command line option --num-ues
-  NB_UE_INST=1;
-
-#if defined (XFORMS)
-  int ret;
-#endif
-
-  start_background_system();
-  if ( load_configmodule(argc,argv) == NULL) {
-    exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
-  }
-
-#ifdef DEBUG_CONSOLE
-  setvbuf(stdout, NULL, _IONBF, 0);
-  setvbuf(stderr, NULL, _IONBF, 0);
-#endif
-
-  PHY_VARS_UE *UE[MAX_NUM_CCs];
-
-  mode = normal_txrx;
-
-  //Panos: RF-sepcific part should get dropped (next 3 lines)?
-  //memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
-
-  //memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
-
-  //set_latency_target();
-
-  // set default parameters
-  //if (UE_flag == 1) set_default_frame_parms(frame_parms);
-
-  logInit();
-
-  printf("Reading in command-line options\n");
-
-  get_options ();
-  if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
-    if (UE_flag == 0) {
-      fprintf(stderr,"Getting configuration failed\n");
-      exit(-1);
-    }
-    else { 
-      printf("Setting nfapi mode to UE_STUB_OFFNET\n");
-      nfapi_mode = 4;
-    }
-  }
-    
-
-#if T_TRACER
-  T_init(T_port, 1-T_nowait, T_dont_fork);
-#endif
-
-
-
-  //randominit (0);
-  set_taus_seed (0);
-
-  if (UE_flag==1) {
-    printf("configuring for UE\n");
-
-    set_comp_log(HW,      LOG_INFO,  LOG_HIGH, 1);
-    set_comp_log(PHY,     LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(MAC,     LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(RLC,     LOG_INFO,   LOG_HIGH | FLAG_THREAD, 1);
-    set_comp_log(PDCP,    LOG_DEBUG,   LOG_HIGH, 1);
-    set_comp_log(OTG,     LOG_INFO,   LOG_HIGH, 1);
-    set_comp_log(RRC,     LOG_INFO,   LOG_HIGH, 1);
-#if defined(ENABLE_ITTI)
-    set_comp_log(EMU,     LOG_INFO,   LOG_MED, 1);
-# if defined(ENABLE_USE_MME)
-    set_comp_log(NAS,     LOG_INFO,   LOG_HIGH, 1);
-# endif
-#endif
-
-  } else {
-    printf("configuring for RAU/RRU\n");
-
-  }
-
-  if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
-  }
-
-  // Panos: Not required for phy_stub_UE mode
-  /*if (opp_enabled ==1) {
-    reset_opp_meas();
-  }
-  cpuf=get_cpu_freq_GHz();*/
-
-#if defined(ENABLE_ITTI)
-
-  if (UE_flag == 1) {
-    log_set_instance_type (LOG_INSTANCE_UE);
-  } else {
-    log_set_instance_type (LOG_INSTANCE_ENB);
-  }
-
-  printf("ITTI init\n");
-  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
-
-  // initialize mscgen log after ITTI
-  MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
-#endif
-
-  if (opt_type != OPT_NONE) {
-    radio_type_t radio_type;
-
-    if (frame_parms[0]->frame_type == FDD)
-      radio_type = RADIO_TYPE_FDD;
-    else
-      radio_type = RADIO_TYPE_TDD;
-
-    if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
-      LOG_E(OPT,"failed to run OPT \n");
-  }
-
-#ifdef PDCP_USE_NETLINK
-  printf("PDCP netlink\n");
-  netlink_init();
-#if defined(PDCP_USE_NETLINK_QUEUES)
-  pdcp_netlink_init();
-#endif
-#endif
-
-//TTN for D2D
-#ifdef Rel14
-  printf ("RRC control socket\n");
-  rrc_control_socket_init();
-  printf ("PDCP PC5S socket\n");
-  pdcp_pc5_socket_init();
-#endif
-
-
-#if !defined(ENABLE_ITTI)
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-#endif
-
-
-  check_clock();
-
-#ifndef PACKAGE_VERSION
-#  define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
-#endif
-
-  LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
-
-  // init the parameters
-  // Panos: Probably don't need next lines for the stub.
-
-  /*for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-    if (UE_flag==1) {
-      frame_parms[CC_id]->nb_antennas_tx     = nb_antenna_tx;
-      frame_parms[CC_id]->nb_antennas_rx     = nb_antenna_rx;
-      frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
-    }
-  }*/
-
-
-
-  printf("Before CC \n");
-
-
-  //NB_UE_INST=2;
-  NB_INST=1;
-
-  if (UE_flag==1) {
-	  PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**)*NB_UE_INST);
-	  for (int i=0; i<NB_UE_INST; i++) {
-		  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-			  PHY_vars_UE_g[i] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
-			  PHY_vars_UE_g[i][CC_id] = init_ue_vars(frame_parms[CC_id], i,abstraction_flag);
-
-			  UE[CC_id] = PHY_vars_UE_g[i][CC_id];
-			  printf("PHY_vars_UE_g[inst][%d] = %p\n",CC_id,UE[CC_id]);
-
-			  if (phy_test==1)
-				  UE[CC_id]->mac_enabled = 0;
-			  else
-				  UE[CC_id]->mac_enabled = 1;
-		  }
-	  }
-  }
-
-  // Panos: Probably don't need these lines for phy_stub
-  /*printf("Runtime table\n");
-  fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
-  cpuf=get_cpu_freq_GHz();*/
-
-
-
-#ifndef DEADLINE_SCHEDULER
-
-  printf("NO deadline scheduler\n");
-  /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
-
-  cpu_set_t cpuset;
-  int s;
-  char cpu_affinity[1024];
-  CPU_ZERO(&cpuset);
-#ifdef CPU_AFFINITY
-  if (get_nprocs() > 2) {
-    CPU_SET(0, &cpuset);
-    s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
-    if (s != 0) {
-      perror( "pthread_setaffinity_np");
-      exit_fun("Error setting processor affinity");
-    }
-    LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
-  }
-#endif
-
-  /* Check the actual affinity mask assigned to the thread */
-  s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
-  if (s != 0) {
-    perror( "pthread_getaffinity_np");
-    exit_fun("Error getting processor affinity ");
-  }
-  memset(cpu_affinity, 0 , sizeof(cpu_affinity));
-  for (int j = 0; j < CPU_SETSIZE; j++) {
-    if (CPU_ISSET(j, &cpuset)) {
-      char temp[1024];
-      sprintf(temp, " CPU_%d ", j);
-      strcat(cpu_affinity, temp);
-    }
-  }
-  LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
-#endif
-
-
-
-
-#if defined(ENABLE_ITTI)
-
-  printf("ITTI enabled\n");
-
-  printf("UE_flag:%d\n", UE_flag);
-  printf("RC.nb_inst:%d\n", RC.nb_inst);
-  /*if ((UE_flag == 1)||
-      (RC.nb_inst > 0))  {*/
-
-  if (UE_flag == 1) {
-    // don't create if node doesn't connect to RRC/S1/GTP
-    //if (create_tasks(UE_flag ? 0 : 1, UE_flag ? 1 : 0) < 0) {
-	  if (create_tasks_ue(1) < 0) {
-      printf("cannot create ITTI tasks\n");
-      exit(-1); // need a softer mode
-    }
-    if(nfapi_mode==3){ //Panos: Here we should add another nfapi_mode for the case of Supervised LTE-D2D
-        UE_config_stub_pnf();
-    }
-    printf("ITTI tasks created\n");
-  }
-  else {
-    printf("No ITTI, Initializing L1\n");
-    RCconfig_L1();
-  }
-#endif
-
-  /*if (phy_test==0) {
-    if (UE_flag==1) {
-      printf("Filling UE band info\n");
-      fill_ue_band_info();
-      dl_phy_sync_success (0, 0, 0, 1);
-    }
-  }*/
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  // Panos: Why we have these initializations twice if in nfapi_mode?
-  pthread_cond_init(&sync_cond,NULL);
-  pthread_mutex_init(&sync_mutex, NULL);
-
-#ifdef XFORMS
-  int UE_id;
-
-  printf("XFORMS\n");
-
-  if (do_forms==1) {
-    fl_initialize (&argc, argv, NULL, 0, 0);
-
-    if (UE_flag==0) {
-      form_stats_l2 = create_form_stats_form();
-      fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats");
-      form_stats = create_form_stats_form();
-      fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-	for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-	  form_enb[CC_id][UE_id] = create_lte_phy_scope_enb();
-	  sprintf (title, "LTE UL SCOPE eNB for CC_id %d, UE %d",CC_id,UE_id);
-	  fl_show_form (form_enb[CC_id][UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-
-	  if (otg_enabled) {
-	    fl_set_button(form_enb[CC_id][UE_id]->button_0,1);
-	    fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON");
-	  } else {
-	    fl_set_button(form_enb[CC_id][UE_id]->button_0,0);
-	    fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF");
-	  }
-	} // CC_id
-      } // UE_id
-    } else {
-      form_stats = create_form_stats_form();
-      fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-      UE_id = 0;
-      form_ue[UE_id] = create_lte_phy_scope_ue();
-      sprintf (title, "LTE DL SCOPE UE");
-      fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-
-      /*
-	if (openair_daq_vars.use_ia_receiver) {
-	fl_set_button(form_ue[UE_id]->button_0,1);
-	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-	} else {
-	fl_set_button(form_ue[UE_id]->button_0,0);
-	fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-	}*/
-      fl_set_button(form_ue[UE_id]->button_0,0);
-      fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-    }
-
-    ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
-
-    if (ret == 0)
-      pthread_setname_np( forms_thread, "xforms" );
-
-    printf("Scope thread created, ret=%d\n",ret);
-  }
-
-#endif
-
-  rt_sleep_ns(10*100000000ULL);
-
-  // Panos: I have commented these lines because cond_init and mutex_init take place above in any case.
-  /*if (nfapi_mode)
-  {
-    printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
-    pthread_cond_init(&sync_cond,NULL);
-    pthread_mutex_init(&sync_mutex, NULL);
-  }*/
-
-  const char *nfapi_mode_str = "<UNKNOWN>";
-
-  switch(nfapi_mode)
-  {
-    case 0:
-      nfapi_mode_str = "MONOLITHIC";
-      break;
-    case 1:
-      nfapi_mode_str = "PNF";
-      break;
-    case 2:
-      nfapi_mode_str = "VNF";
-      break;
-    case 3:
-      nfapi_mode_str = "UE_STUB_PNF";
-      break;
-    case 4:
-      nfapi_mode_str = "UE_STUB_OFFNET";
-      break;
-    default:
-      nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
-      break;
-  }
-  printf("NFAPI MODE:%s\n", nfapi_mode_str);
-
-
-  if (nfapi_mode<3) // VNF
-    wait_nfapi_init("main?");
-
-  printf("START MAIN THREADS, nfapi_mode:%d \n", nfapi_mode);
-
-  // start the main threads
-  if (UE_flag == 1) {
-    int eMBMS_active = 0;
-    //init_UE(1,eMBMS_active,uecap_xer_in);
-    number_of_cards = 1;
-
-    config_sync_var=0;
-    if (nfapi_mode==3) // UE-STUB-PNF
-    	{
-    	wait_nfapi_init("main?");
-    	}
-    // Panos: Call init_UE_stub instead of init_UE as we are always on nfapi_mode=3
-    //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking));
-
-
-    // Panos: CHANGE we call init_timer_thread() from inside init_UE_stub() now
-    //init_timer_thread();
-
-    // Panos: Temporarily we will be using single set of threads for multiple UEs.
-    //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
-    init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
-
-
-    /*for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-      PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
-      PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
-    }*/
-  }
-  // Panos: We should never enter this else case for nfapi_mode=3.
-  /*else {
-    number_of_cards = 1;
-    printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
-    if (RC.nb_L1_inst > 0) {
-      printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync);
-      init_eNB(single_thread_flag,wait_for_sync);
-      //      for (inst=0;inst<RC.nb_L1_inst;inst++)
-      //	for (CC_id=0;CC_id<RC.nb_L1_CC[inst];CC_id++) phy_init_lte_eNB(RC.eNB[inst][CC_id],0,0);
-    }
-
-    printf("wait_eNBs()\n");
-    wait_eNBs();
-
-    printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
-    if (RC.nb_RU >0) {
-      printf("Initializing RU threads\n");
-      init_RU(rf_config_file);
-      for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
-	RC.ru[ru_id]->rf_map.card=0;
-	RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset;
-      }
-    }
-
-    config_sync_var=0;
-
-    if (nfapi_mode==1) // PNF
-    {
-      wait_nfapi_init("main?");
-    }
-
-    printf("wait RUs\n");
-    wait_RUs();
-    printf("ALL RUs READY!\n");
-    printf("RC.nb_RU:%d\n", RC.nb_RU);
-    // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
-    printf("ALL RUs ready - init eNBs\n");
-
-    if (nfapi_mode != 1 && nfapi_mode != 2)
-    {
-      printf("Not NFAPI mode - call init_eNB_afterRU()\n");
-      init_eNB_afterRU();
-    }
-    else
-    {
-      printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n");
-    }
-
-    printf("ALL RUs ready - ALL eNBs ready\n");
-  }*/
-  if (phy_test==0) {
-      if (UE_flag==1) {
-        printf("Filling UE band info\n");
-        fill_ue_band_info();
-        dl_phy_sync_success (0, 0, 0, 1);
-      }
-    }
-
-
-  // connect the TX/RX buffers
-  if (UE_flag==1) {
-
-    /*for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-
-
-#ifdef OAI_USRP
-      UE[CC_id]->hw_timing_advance = timing_advance;
-#else
-      UE[CC_id]->hw_timing_advance = 160;
-#endif
-    }*/
-
-
-
-
-    // Panos: No need to call setup_ue_buffers() for nfapi_mode=3
-    /*if (setup_ue_buffers(UE,&openair0_cfg[0])!=0) {
-      printf("Error setting up eNB buffer\n");
-      exit(-1);
-    }*/
-
-
-    // Panos: Similar for nfapi_mode=3
-    /*if (input_fd) {
-      printf("Reading in from file to antenna buffer %d\n",0);
-      if (fread(UE[0]->common_vars.rxdata[0],
-		sizeof(int32_t),
-		frame_parms[0]->samples_per_tti*10,
-		input_fd) != frame_parms[0]->samples_per_tti*10)
-	printf("error reading from file\n");
-    }*/
-    //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
-  } else {
-
-    printf("eNB mode\n");
-
-  }
-
-  printf("Sending sync to all threads\n");
-
-  /*if(nfapi_mode==3){
-	  usleep(1000);
-  }*/
-
-  pthread_mutex_lock(&sync_mutex);
-  sync_var=0;
-  pthread_cond_broadcast(&sync_cond);
-  pthread_mutex_unlock(&sync_mutex);
-  printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
-  end_configmodule();
-  printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-  //getchar();
-
-#if defined(ENABLE_ITTI)
-  printf("Entering ITTI signals handler\n");
-  itti_wait_tasks_end();
-  printf("Returned from ITTI signal handler\n");
-  oai_exit=1;
-  printf("oai_exit=%d\n",oai_exit);
-#else
-
-  while (oai_exit==0)
-    rt_sleep_ns(100000000ULL);
-  printf("Terminating application - oai_exit=%d\n",oai_exit);
-
-#endif
-
-  // stop threads
-#ifdef XFORMS
-  printf("waiting for XFORMS thread\n");
-
-  if (do_forms==1) {
-    pthread_join(forms_thread,&status);
-    fl_hide_form(form_stats->stats_form);
-    fl_free_form(form_stats->stats_form);
-
-    if (UE_flag==1) {
-      fl_hide_form(form_ue[0]->lte_phy_scope_ue);
-      fl_free_form(form_ue[0]->lte_phy_scope_ue);
-    } else {
-      fl_hide_form(form_stats_l2->stats_form);
-      fl_free_form(form_stats_l2->stats_form);
-
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-	for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-	  fl_hide_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb);
-	  fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb);
-	}
-      }
-    }
-  }
-
-#endif
-
-  printf("stopping MODEM threads\n");
-
-  // cleanup
-  if (UE_flag == 1) {
-  } /*else {
-    stop_eNB(1);
-  }*/
-
-
-  pthread_cond_destroy(&sync_cond);
-  pthread_mutex_destroy(&sync_mutex);
-
-  pthread_cond_destroy(&nfapi_sync_cond);
-  pthread_mutex_destroy(&nfapi_sync_mutex);
-
-
-  // Panos: No RF in phy_stub mode: Exclude the following lines
-  // *** Handle per CC_id openair0
-  /*if (UE_flag==1) {
-    if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
-      PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
-  }
-  else {
-    for(ru_id=0; ru_id<NB_RU; ru_id++) {
-      if (RC.ru[ru_id]->rfdevice.trx_end_func)
-	RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
-      if (RC.ru[ru_id]->ifdevice.trx_end_func)
-	RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
-
-    }
-  }*/
-  if (ouput_vcd)
-    VCD_SIGNAL_DUMPER_CLOSE();
-
-  if (opt_enabled == 1)
-    terminate_opt();
-
-  logClean();
-
-  return 0;
-}
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 88f6cf0a38b79314d37699d37e182942248c3bfa..bd6596f75c73c651ddcfcd743229f783f7e4b174 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -139,7 +139,7 @@
 {"ue-max-power",     	       NULL,		      0,		iptr:&(tx_max_power[0]),	    defintval:90,   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,				iptr:&(NB_UE_INST),	    defintval:1,   	TYPE_INT,	   0},     \
+{"num-ues",     	       		   NULL,		      	  0,				u8ptr:&(NB_UE_INST),	    defuintval:1,   	TYPE_UINT8,	   0},     \
 {"r"  ,                        CONFIG_HLP_PRB,        0,                u8ptr:&(frame_parms[0]->N_RB_DL),   defintval:25,   TYPE_UINT8,    0}     \
 }
 
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 2b91c0594d2046e3a20e511a4b0561a999a7080e..84e77c1ef829f5da1946a37a11ba86db27bc59c5 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -81,7 +81,17 @@ void *UE_thread(void *arg);
 void init_UE(int nb_inst,int,int,int);
 void init_UE_stub(int nb_inst,int,int,char*);
 void init_UE_stub_single_thread(int nb_inst,int,int,char*);
+int init_timer_thread(void);
 extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
+extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
+                          unsigned char _multicast_group, char *multicast_ifname);
+extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
+extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
+extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
+extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
+extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
+extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
+
 //extern int tx_req_UE_MAC1();
 
 void ue_stub_rx_handler(unsigned int, char *);
@@ -891,10 +901,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
   char threadname[256];
   //sprintf(threadname,"UE_%d_proc", UE->Mod_id);
 
-  // Panos: Call (Sched_Rsp_t) get_nfapi_sched_response(UE->Mod_ID) to get all
-  //sched_response config messages which concern the specific UE. Inside this
-  //function we should somehow make the translation of rnti to Mod_ID.
-
   //proc->instance_cnt_rxtx=-1;
 
   phy_stub_ticking->ticking_var = -1;
@@ -946,26 +952,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
     	UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t));
     	UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
-    	//UL_INFO->rx_ind.header.message_id = 3225;
 
 
     	UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t));
     	UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
-    	//UL_INFO->crc_ind.header.message_id = 3225;
 
     	UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t));
     	UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
-    	//UL_INFO->harq_ind.header.message_id = 3225;
 
     	UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
     	UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
-    	//UL_INFO->sr_ind.header.message_id = 3225;
 
 
 
 
     for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
-    	//LOG_I(MAC, "Panos-D: UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
+    	//LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
     	UE = PHY_vars_UE_g[Mod_id][0];
     lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx);
     if ((sf_type == SF_DL) ||
@@ -1210,9 +1212,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
   char threadname[256];
   sprintf(threadname,"UE_%d_proc", UE->Mod_id);
 
-  // Panos: Call (Sched_Rsp_t) get_nfapi_sched_response(UE->Mod_ID) to get all
-  //sched_response config messages which concern the specific UE. Inside this
-  //function we should somehow make the translation of rnti to Mod_ID.
 
   //proc->instance_cnt_rxtx=-1;
 
@@ -2049,7 +2048,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg)
 
 
 
-// Panos: This timer thread is used only in the phy_sub mode as an independent timer
+// Panos: This timer thread is used only in the phy_stub mode as an independent timer
 // which will be ticking and provide the SFN/SF values that will be used from the UE threads
 // playing the role of nfapi-pnf.
 
@@ -2062,7 +2061,7 @@ static void* timer_thread( void* param ) {
   phy_stub_ticking->ticking_var = -1;
   PHY_VARS_UE *UE;
   UE = PHY_vars_UE_g[0][0];
-  double t_diff;
+  //double t_diff;
   int external_timer = 0;
 
 
@@ -2097,7 +2096,7 @@ static void* timer_thread( void* param ) {
 
   clock_gettime(CLOCK_MONOTONIC, &t_start);
   T_0 = (uint64_t) t_start.tv_sec*1000000000 + t_start.tv_nsec;
-  LOG_D(MAC, "Panos-D: timer_thread(), T_0 value: %" PRId64 "\n", T_0);
+  LOG_D(MAC, "timer_thread(), T_0 value: %" PRId64 "\n", T_0);
 
   while (!oai_exit) {
 
@@ -2163,11 +2162,11 @@ static void* timer_thread( void* param ) {
     }
 
 
-    stop_meas(&UE->timer_stats);
+    /*stop_meas(&UE->timer_stats);
     t_diff = get_time_meas_us(&UE->timer_stats);
 
     stop_meas(&UE->timer_stats);
-    t_diff = get_time_meas_us(&UE->timer_stats);
+    t_diff = get_time_meas_us(&UE->timer_stats);*/
   }
   free(phy_stub_ticking);
   pthread_cond_destroy(&phy_stub_ticking->cond_ticking);
@@ -2324,7 +2323,6 @@ static void* timer_thread( void* param ) {
 
 
 int init_timer_thread(void) {
-	// Panos: CAREFUL Originally this was set to PHY_VARS_UE *UE=PHY_vars_UE_g[0]
   //PHY_VARS_UE *UE=PHY_vars_UE_g[0];
 	PHY_VARS_UE *UE=PHY_vars_UE_g[0][0];
   phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking));
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index a2cf21e60ea108fa34742de027c29530c06d71cc..c178dd3c2378c9ff253990680c7a3a00fc792896 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -216,6 +216,7 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots
 
 extern void reset_opp_meas(void);
 extern void print_opp_meas(void);
+extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
 
 extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
 			  uint8_t UE_id,
@@ -1167,6 +1168,7 @@ int main( int argc, char **argv )
         nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
         break;
     }
+    printf("NFAPI MODE:%s\n", nfapi_mode_str);
 
 
   // start the main threads