diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index 66932dfdeb064b759850ea201e955b81abde6fbe..1d74fd919c689c1d72bcf6a6ddc7f2724b2cd84a 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -109,8 +109,6 @@ get_prach_resources(module_id_t module_idP,
 		    uint8_t first_Msg3,
 		    RACH_ConfigDedicated_t * rach_ConfigDedicated)
 {
-	LOG_I(MAC, "Panos-D: get_prach_resources 1");
-
     uint8_t Msg3_size = UE_mac_inst[module_idP].RA_Msg3_size;
     PRACH_RESOURCES_t *prach_resources =
 	&UE_mac_inst[module_idP].RA_prach_resources;
@@ -216,7 +214,6 @@ get_prach_resources(module_id_t module_idP,
     if (first_Msg3 == 1) {
 	if (noGroupB == 1) {
 	    // use Group A procedure
-		LOG_I(MAC, "Panos-D: get_prach_resources 2");
 	    UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
 		(taus()) % numberOfRA_Preambles;
 	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
@@ -225,14 +222,12 @@ get_prach_resources(module_id_t module_idP,
 	} else if ((Msg3_size < messageSizeGroupA) ||
 		   (get_PL(module_idP, 0, eNB_index) > PLThreshold)) {
 	    // use Group A procedure
-		LOG_I(MAC, "Panos-D: get_prach_resources 3");
 		UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
 		(taus()) % sizeOfRA_PreamblesGroupA;
 	    UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex =
 		0;
 	    UE_mac_inst[module_idP].RA_usedGroupA = 1;
 	} else {		// use Group B
-		LOG_I(MAC, "Panos-D: get_prach_resources 4");
 		UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
 		sizeOfRA_PreamblesGroupA +
 		(taus()) % (numberOfRA_Preambles -
@@ -291,7 +286,6 @@ get_prach_resources(module_id_t module_idP,
     // choose RA-RNTI
     UE_mac_inst[module_idP].RA_prach_resources.ra_RNTI =
 	1 + t_id + 10 * f_id;
-    LOG_I(MAC, "Panos-D: get_prach_resources 4");
 }
 
 void
@@ -360,7 +354,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
     // Panos: Modification for phy_stub_ue operation
     if(nfapi_mode == 3) { // Panos: phy_stub_ue mode
     	  UE_mode = UE_mac_inst[module_idP].UE_mode[0];
-    	  LOG_I(MAC, "Panos-D: ue_get_rach 2, UE_mode: %d", UE_mode);
+    	  LOG_D(MAC, "ue_get_rach , UE_mode: %d", UE_mode);
     }
     else { // Full stack mode
     	  UE_mode = get_ue_mode(module_idP,0,eNB_indexP);
@@ -381,7 +375,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
 		"Transmission on secondary CCs is not supported yet\n");
 
     if (UE_mode == PRACH) {
-    	LOG_I(MAC, "Panos-D: ue_get_rach 3, RA_active value: %d", UE_mac_inst[module_idP].RA_active);
+    	LOG_D(MAC, "ue_get_rach 3, RA_active value: %d", UE_mac_inst[module_idP].RA_active);
 	if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
 	    rach_ConfigCommon =
 		&UE_mac_inst[module_idP].
@@ -413,7 +407,6 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
 		  module_idP, frameP, Size);
 
 	    if (Size > 0) {
-	    	LOG_I(MAC, "Panos-D: ue_get_rach 5");
 		UE_mac_inst[module_idP].RA_active = 1;
 		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER =
 		    1;
@@ -684,566 +677,3 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
 
 
 
-
-
-
-
-
-	/*PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
-				       frame_t frameP, uint8_t eNB_indexP,
-				       sub_frame_t subframeP)
-	{
-
-	<<<<<<< HEAD
-	  LOG_I(MAC, "Panos-D: ue_get_rach 1");
-	  uint8_t                  Size               = 0;
-	  UE_MODE_t UE_mode;
-	  // Panos: Modification for phy_stub_ue operation
-	  if(nfapi_mode == 3) { // Panos: phy_stub_ue mode
-		  UE_mode = UE_mac_inst[module_idP].UE_mode[0];
-		  LOG_I(MAC, "Panos-D: ue_get_rach 2, UE_mode: %d", UE_mode);
-	  }
-	  else { // Full stack mode
-		  UE_mode = get_ue_mode(module_idP,0,eNB_indexP);
-	  }
-
-
-	  uint8_t                  lcid               = CCCH;
-	  uint16_t                 Size16;
-	  struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL;
-	  int32_t                  frame_diff         = 0;
-	  mac_rlc_status_resp_t    rlc_status;
-	  uint8_t                  dcch_header_len    = 0;
-	  uint16_t                 sdu_lengths[8];
-	  uint8_t                  ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
-
-	  AssertFatal(CC_id==0,
-		      "Transmission on secondary CCs is not supported yet\n");
-
-	  if (UE_mode == PRACH) {
-		  LOG_I(MAC, "Panos-D: ue_get_rach 3, RA_active value: %d", UE_mac_inst[module_idP].RA_active);
-	    if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
-	      rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
-	    } else {
-	    	//AssertFatal(UE_mac_inst[module_idP].radioResourceConfigCommon!=NULL,"RadioResourceConfigCommon Null");
-	      return(NULL);
-	    }
-
-	    if (UE_mac_inst[module_idP].RA_active == 0) {
-	    	LOG_I(MAC, "Panos-D: ue_get_rach 4");
-	      LOG_I(MAC,"RA not active\n");
-	      // check if RRC is ready to initiate the RA procedure
-	      Size = mac_rrc_data_req(module_idP,
-				      CC_id,
-				      frameP,
-				      CCCH,1,
-				      &UE_mac_inst[module_idP].CCCH_pdu.payload[sizeof(SCH_SUBHEADER_SHORT)+1],0,
-				      eNB_indexP,
-				      0);
-	      Size16 = (uint16_t)Size;
-
-	      //  LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
-	      LOG_I(RRC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
-		    frameP, module_idP, eNB_indexP, module_idP);
-	      LOG_I(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
-
-	      if (Size>0) {
-	    	  LOG_I(MAC, "Panos-D: ue_get_rach 5");
-		UE_mac_inst[module_idP].RA_active                        = 1;
-		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
-		UE_mac_inst[module_idP].RA_Msg3_size                     = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT);
-		UE_mac_inst[module_idP].RA_prachMaskIndex                = 0;
-		UE_mac_inst[module_idP].RA_prach_resources.Msg3          = UE_mac_inst[module_idP].CCCH_pdu.payload;
-		UE_mac_inst[module_idP].RA_backoff_cnt                   = 0;  // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-
-		AssertFatal(rach_ConfigCommon!=NULL,
-			    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
-		UE_mac_inst[module_idP].RA_window_cnt                    = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
-
-		if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-		  UE_mac_inst[module_idP].RA_window_cnt = 10;  // Note: 9 subframe window doesn't exist, after 8 is 10!
-		}
-
-		UE_mac_inst[module_idP].RA_tx_frame         = frameP;
-		UE_mac_inst[module_idP].RA_tx_subframe      = subframeP;
-		UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-		// Fill in preamble and PRACH resource
-		get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
-
-		generate_ulsch_header((uint8_t*)&UE_mac_inst[module_idP].CCCH_pdu.payload[0],  // mac header
-				      1,      // num sdus
-				      0,            // short pading
-				      &Size16,  // sdu length
-				      &lcid,    // sdu lcid
-				      NULL,  // power headroom
-				      NULL,  // crnti
-				      NULL,  // truncated bsr
-				      NULL, // short bsr
-				      NULL, // long_bsr
-				      1); //post_padding
-		return(&UE_mac_inst[module_idP].RA_prach_resources);
-
-	      } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) {
-		// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
-		dcch_header_len = 2 + 2;  /// SHORT Subheader + C-RNTI control element
-		rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
-						DCCH,
-						6
-	#ifdef Rel14
-	               ,0, 0
-	#endif
-	               );
-
-		if (UE_mac_inst[module_idP].crnti_before_ho)
-		  LOG_D(MAC,
-			"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
-			module_idP,frameP, UE_mac_inst[module_idP].crnti,UE_mac_inst[module_idP].crnti_before_ho, rlc_status.bytes_in_buffer,dcch_header_len);
-		else
-		  LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
-			module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len);
-
-		sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti,
-						  eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
-						  DCCH,
-						  6,	//not used
-						  (char *)&ulsch_buff[0]
-	#ifdef Rel14
-	                 ,0,
-	                  0
-	#endif
-	                  );
-
-		LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]);
-		update_bsr(module_idP, frameP, subframeP,eNB_indexP);
-		UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] =
-		  locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]]);
-
-		//TO DO: fill BSR infos in UL TBS
-
-		//header_len +=2;
-		UE_mac_inst[module_idP].RA_active                        = 1;
-		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
-		UE_mac_inst[module_idP].RA_Msg3_size                     = Size+dcch_header_len;
-		UE_mac_inst[module_idP].RA_prachMaskIndex                = 0;
-		UE_mac_inst[module_idP].RA_prach_resources.Msg3          = ulsch_buff;
-		UE_mac_inst[module_idP].RA_backoff_cnt                   = 0;  // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-
-		AssertFatal(rach_ConfigCommon!=NULL,
-			    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
-		UE_mac_inst[module_idP].RA_window_cnt                    = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
-
-		if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-		  UE_mac_inst[module_idP].RA_window_cnt = 10;  // Note: 9 subframe window doesn't exist, after 8 is 10!
-		}
-
-
-		UE_mac_inst[module_idP].RA_tx_frame         = frameP;
-		UE_mac_inst[module_idP].RA_tx_subframe      = subframeP;
-		UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-		// Fill in preamble and PRACH resource
-		get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
-		generate_ulsch_header((uint8_t*)ulsch_buff,  // mac header
-				      1,      // num sdus
-				      0,            // short pading
-				      &Size16,  // sdu length
-				      &lcid,    // sdu lcid
-				      NULL,  // power headroom
-				      &UE_mac_inst[module_idP].crnti,  // crnti
-				      NULL,  // truncated bsr
-				      NULL, // short bsr
-				      NULL, // long_bsr
-				      0); //post_padding
-
-		return(&UE_mac_inst[module_idP].RA_prach_resources);
-	      }
-	    } else { // RACH is active
-	      LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",module_idP,
-		    frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt,
-		    UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe);
-
-	      // compute backoff parameters
-	      if (UE_mac_inst[module_idP].RA_backoff_cnt>0) {
-		frame_diff = (sframe_t)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
-
-		if (frame_diff < 0) {
-		  frame_diff = -frame_diff;
-		}
-
-		UE_mac_inst[module_idP].RA_backoff_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_backoff_subframe));
-
-		UE_mac_inst[module_idP].RA_backoff_frame    = frameP;
-		UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-	      }
-
-	      // compute RA window parameters
-	      if (UE_mac_inst[module_idP].RA_window_cnt>0) {
-		frame_diff = (frame_t)frameP - UE_mac_inst[module_idP].RA_tx_frame;
-
-		if (frame_diff < 0) {
-		  frame_diff = -frame_diff;
-		}
-
-		UE_mac_inst[module_idP].RA_window_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_tx_subframe));
-		LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, adjusted window cnt %d\n",module_idP,
-		      frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt);
-	      }
-
-	      if ((UE_mac_inst[module_idP].RA_window_cnt<=0) &&
-		  (UE_mac_inst[module_idP].RA_backoff_cnt<=0)) {
-
-		UE_mac_inst[module_idP].RA_tx_frame    = frameP;
-		UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
-		UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER++;
-		UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER +=
-		  (rach_ConfigCommon->powerRampingParameters.powerRampingStep<<1);  // 2dB increments in ASN.1 definition
-		int preambleTransMax = -1;
-		switch (rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax) {
-		case PreambleTransMax_n3:
-		  preambleTransMax = 3;
-		  break;
-		case PreambleTransMax_n4:
-		  preambleTransMax = 4;
-		  break;
-		case PreambleTransMax_n5:
-		  preambleTransMax = 5;
-		  break;
-		case PreambleTransMax_n6:
-		  preambleTransMax = 6;
-		  break;
-		case PreambleTransMax_n7:
-		  preambleTransMax = 7;
-		  break;
-		case PreambleTransMax_n8:
-		  preambleTransMax = 8;
-		  break;
-		case PreambleTransMax_n10:
-		  preambleTransMax = 10;
-		  break;
-		case PreambleTransMax_n20:
-		  preambleTransMax = 20;
-		  break;
-		case PreambleTransMax_n50:
-		  preambleTransMax = 50;
-		  break;
-		case PreambleTransMax_n100:
-		  preambleTransMax = 100;
-		  break;
-		case PreambleTransMax_n200:
-		  preambleTransMax = 200;
-		  break;
-		}
-
-		if (UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax) {
-		  LOG_D(MAC,"[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",module_idP,frameP,preambleTransMax);
-		  // send message to RRC
-		  UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER=1;
-		  UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(module_idP,CC_id);
-	=======
-
-	    uint8_t Size = 0;
-	    UE_MODE_t UE_mode = get_ue_mode(module_idP, 0, eNB_indexP);
-	    uint8_t lcid = CCCH;
-	    uint16_t Size16;
-	    struct RACH_ConfigCommon *rach_ConfigCommon =
-		(struct RACH_ConfigCommon *) NULL;
-	    int32_t frame_diff = 0;
-	    mac_rlc_status_resp_t rlc_status;
-	    uint8_t dcch_header_len = 0;
-	    uint16_t sdu_lengths[8];
-	    uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
-
-	    AssertFatal(CC_id == 0,
-			"Transmission on secondary CCs is not supported yet\n");
-
-	    if (UE_mode == PRACH) {
-		if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
-		    rach_ConfigCommon =
-			&UE_mac_inst[module_idP].
-			radioResourceConfigCommon->rach_ConfigCommon;
-		} else {
-		    return (NULL);
-		}
-
-		if (UE_mac_inst[module_idP].RA_active == 0) {
-		    LOG_I(MAC, "RA not active\n");
-		    // check if RRC is ready to initiate the RA procedure
-		    Size = mac_rrc_data_req_ue(module_idP,
-					    CC_id,
-					    frameP,
-					    CCCH, 1,
-					    &UE_mac_inst[module_idP].
-					    CCCH_pdu.payload[sizeof
-							     (SCH_SUBHEADER_SHORT)
-							     + 1], eNB_indexP,
-					    0);
-		    Size16 = (uint16_t) Size;
-
-		    //  LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
-		    LOG_I(RRC,
-			  "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
-			  frameP, module_idP, eNB_indexP, module_idP);
-		    LOG_I(MAC,
-			  "[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",
-			  module_idP, frameP, Size);
-
-		    if (Size > 0) {
-
-			UE_mac_inst[module_idP].RA_active = 1;
-			UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER =
-			    1;
-			UE_mac_inst[module_idP].RA_Msg3_size =
-			    Size + sizeof(SCH_SUBHEADER_SHORT) +
-			    sizeof(SCH_SUBHEADER_SHORT);
-			UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
-			UE_mac_inst[module_idP].RA_prach_resources.Msg3 =
-			    UE_mac_inst[module_idP].CCCH_pdu.payload;
-			UE_mac_inst[module_idP].RA_backoff_cnt = 0;	// add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-
-			AssertFatal(rach_ConfigCommon != NULL,
-				    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",
-				    module_idP, frameP);
-			UE_mac_inst[module_idP].RA_window_cnt =
-			    2 +
-			    rach_ConfigCommon->ra_SupervisionInfo.
-			    ra_ResponseWindowSize;
-
-			if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-			    UE_mac_inst[module_idP].RA_window_cnt = 10;	// Note: 9 subframe window doesn't exist, after 8 is 10!
-			}
-
-			UE_mac_inst[module_idP].RA_tx_frame = frameP;
-			UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
-			UE_mac_inst[module_idP].RA_backoff_frame = frameP;
-			UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-			// Fill in preamble and PRACH resource
-			get_prach_resources(module_idP, CC_id, eNB_indexP,
-					    subframeP, 1, NULL);
-
-			generate_ulsch_header((uint8_t *) & UE_mac_inst[module_idP].CCCH_pdu.payload[0],	// mac header
-					      1,	// num sdus
-					      0,	// short pading
-					      &Size16,	// sdu length
-					      &lcid,	// sdu lcid
-					      NULL,	// power headroom
-					      NULL,	// crnti
-					      NULL,	// truncated bsr
-					      NULL,	// short bsr
-					      NULL,	// long_bsr
-					      1);	//post_padding
-			return (&UE_mac_inst[module_idP].RA_prach_resources);
-
-		    } else if (UE_mac_inst[module_idP].
-			       scheduling_info.BSR_bytes[UE_mac_inst[module_idP].
-							 scheduling_info.LCGID
-							 [DCCH]] > 0) {
-			// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
-			dcch_header_len = 2 + 2;	/// SHORT Subheader + C-RNTI control element
-			rlc_status =
-			    mac_rlc_status_ind(module_idP,
-					       UE_mac_inst[module_idP].crnti,
-					       eNB_indexP, frameP, subframeP,
-					       ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6);
-
-			if (UE_mac_inst[module_idP].crnti_before_ho)
-			    LOG_D(MAC,
-				  "[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
-				  module_idP, frameP,
-				  UE_mac_inst[module_idP].crnti,
-				  UE_mac_inst[module_idP].crnti_before_ho,
-				  rlc_status.bytes_in_buffer, dcch_header_len);
-			else
-			    LOG_D(MAC,
-				  "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
-				  module_idP, frameP, rlc_status.bytes_in_buffer,
-				  dcch_header_len);
-
-			sdu_lengths[0] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_indexP, frameP, ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6,	//not used
-							  (char *) &ulsch_buff[0]);
-
-			LOG_D(MAC, "[UE %d] TX Got %d bytes for DCCH\n",
-			      module_idP, sdu_lengths[0]);
-			update_bsr(module_idP, frameP, subframeP, eNB_indexP);
-			UE_mac_inst[module_idP].
-			    scheduling_info.BSR[UE_mac_inst[module_idP].
-						scheduling_info.LCGID[DCCH]] =
-			    locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE,
-							UE_mac_inst
-							[module_idP].scheduling_info.BSR_bytes
-							[UE_mac_inst
-							 [module_idP].scheduling_info.LCGID
-							 [DCCH]]);
-
-			//TO DO: fill BSR infos in UL TBS
-
-			//header_len +=2;
-			UE_mac_inst[module_idP].RA_active = 1;
-			UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER =
-			    1;
-			UE_mac_inst[module_idP].RA_Msg3_size =
-			    Size + dcch_header_len;
-			UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
-			UE_mac_inst[module_idP].RA_prach_resources.Msg3 =
-			    ulsch_buff;
-			UE_mac_inst[module_idP].RA_backoff_cnt = 0;	// add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
-
-			AssertFatal(rach_ConfigCommon != NULL,
-				    "[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",
-				    module_idP, frameP);
-			UE_mac_inst[module_idP].RA_window_cnt =
-			    2 +
-			    rach_ConfigCommon->ra_SupervisionInfo.
-			    ra_ResponseWindowSize;
-
-			if (UE_mac_inst[module_idP].RA_window_cnt == 9) {
-			    UE_mac_inst[module_idP].RA_window_cnt = 10;	// Note: 9 subframe window doesn't exist, after 8 is 10!
-			}
-
-
-			UE_mac_inst[module_idP].RA_tx_frame = frameP;
-			UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
-			UE_mac_inst[module_idP].RA_backoff_frame = frameP;
-			UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-			// Fill in preamble and PRACH resource
-			get_prach_resources(module_idP, CC_id, eNB_indexP,
-					    subframeP, 1, NULL);
-			generate_ulsch_header((uint8_t *) ulsch_buff,	// mac header
-					      1,	// num sdus
-					      0,	// short pading
-					      &Size16,	// sdu length
-					      &lcid,	// sdu lcid
-					      NULL,	// power headroom
-					      &UE_mac_inst[module_idP].crnti,	// crnti
-					      NULL,	// truncated bsr
-					      NULL,	// short bsr
-					      NULL,	// long_bsr
-					      0);	//post_padding
-
-			return (&UE_mac_inst[module_idP].RA_prach_resources);
-		    }
-		} else {		// RACH is active
-		    LOG_D(MAC,
-			  "[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
-			  module_idP, frameP, subframeP,
-			  UE_mac_inst[module_idP].RA_window_cnt,
-			  UE_mac_inst[module_idP].RA_tx_frame,
-			  UE_mac_inst[module_idP].RA_tx_subframe);
-
-		    // compute backoff parameters
-		    if (UE_mac_inst[module_idP].RA_backoff_cnt > 0) {
-			frame_diff =
-			    (sframe_t) frameP -
-			    UE_mac_inst[module_idP].RA_backoff_frame;
-
-			if (frame_diff < 0) {
-			    frame_diff = -frame_diff;
-			}
-
-			UE_mac_inst[module_idP].RA_backoff_cnt -=
-			    ((10 * frame_diff) +
-			     (subframeP -
-			      UE_mac_inst[module_idP].RA_backoff_subframe));
-
-			UE_mac_inst[module_idP].RA_backoff_frame = frameP;
-			UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
-		    }
-		    // compute RA window parameters
-		    if (UE_mac_inst[module_idP].RA_window_cnt > 0) {
-			frame_diff =
-			    (frame_t) frameP - UE_mac_inst[module_idP].RA_tx_frame;
-
-			if (frame_diff < 0) {
-			    frame_diff = -frame_diff;
-			}
-
-			UE_mac_inst[module_idP].RA_window_cnt -=
-			    ((10 * frame_diff) +
-			     (subframeP - UE_mac_inst[module_idP].RA_tx_subframe));
-			LOG_D(MAC,
-			      "[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, adjusted window cnt %d\n",
-			      module_idP, frameP, subframeP,
-			      UE_mac_inst[module_idP].RA_window_cnt);
-		    }
-
-		    if ((UE_mac_inst[module_idP].RA_window_cnt <= 0) &&
-			(UE_mac_inst[module_idP].RA_backoff_cnt <= 0)) {
-
-			UE_mac_inst[module_idP].RA_tx_frame = frameP;
-			UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
-			UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER++;
-			UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER += (rach_ConfigCommon->powerRampingParameters.powerRampingStep << 1);	// 2dB increments in ASN.1 definition
-			int preambleTransMax = -1;
-			switch (rach_ConfigCommon->ra_SupervisionInfo.
-				preambleTransMax) {
-			case PreambleTransMax_n3:
-			    preambleTransMax = 3;
-			    break;
-			case PreambleTransMax_n4:
-			    preambleTransMax = 4;
-			    break;
-			case PreambleTransMax_n5:
-			    preambleTransMax = 5;
-			    break;
-			case PreambleTransMax_n6:
-			    preambleTransMax = 6;
-			    break;
-			case PreambleTransMax_n7:
-			    preambleTransMax = 7;
-			    break;
-			case PreambleTransMax_n8:
-			    preambleTransMax = 8;
-			    break;
-			case PreambleTransMax_n10:
-			    preambleTransMax = 10;
-			    break;
-			case PreambleTransMax_n20:
-			    preambleTransMax = 20;
-			    break;
-			case PreambleTransMax_n50:
-			    preambleTransMax = 50;
-			    break;
-			case PreambleTransMax_n100:
-			    preambleTransMax = 100;
-			    break;
-			case PreambleTransMax_n200:
-			    preambleTransMax = 200;
-			    break;
-			}
-
-			if (UE_mac_inst[module_idP].
-			    RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax) {
-			    LOG_D(MAC,
-				  "[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",
-				  module_idP, frameP, preambleTransMax);
-			    // send message to RRC
-			    UE_mac_inst[module_idP].
-				RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
-			    UE_mac_inst[module_idP].
-				RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER
-				= get_Po_NOMINAL_PUSCH(module_idP, CC_id);
-			}
-
-			UE_mac_inst[module_idP].RA_window_cnt =
-			    2 +
-			    rach_ConfigCommon->ra_SupervisionInfo.
-			    ra_ResponseWindowSize;
-			UE_mac_inst[module_idP].RA_backoff_cnt = 0;
-
-			// Fill in preamble and PRACH resource
-			get_prach_resources(module_idP, CC_id, eNB_indexP,
-					    subframeP, 0, NULL);
-			return (&UE_mac_inst[module_idP].RA_prach_resources);
-		    }
-	>>>>>>> main/develop
-		}
-	    } else if (UE_mode == PUSCH) {
-		LOG_D(MAC,
-		      "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...",
-		      module_idP);
-		AssertFatal(1 == 0, "");
-	    }
-
-	    return (NULL);
-	}	*/
-
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c
index 18e2542695ed055eae55b1c91791e22ae44b4640..9d7bb20875f3394ed6503cea01e5f06f8a3edf5a 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.c
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.c
@@ -85,7 +85,6 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
 
 void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti) {
 
-	LOG_I(MAC, "Panos-D: fill_sr_indication_UE_MAC 1 \n");
 
   pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
 
@@ -155,7 +154,7 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_
 
 void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI) {
 
-	LOG_I(MAC, "Panos-D: fill_rach_indication_UE_MAC 1 \n");
+	LOG_D(MAC, "fill_rach_indication_UE_MAC 1 \n");
 	pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
 	UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
 
@@ -367,7 +366,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
     uint8_t access_mode=SCHEDULED_ACCESS;
     if(buflen>0){
     	if(UE_mac_inst[Mod_id].first_ULSCH_Tx == 1){ // Msg3 case
-    		LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 2.2, Mod_id:%d, SFN/SF: %d/%d \n", Mod_id, frame, subframe);
+    		LOG_D(MAC, "handle_nfapi_ul_pdu_UE_MAC 2.2, Mod_id:%d, SFN/SF: %d/%d \n", Mod_id, frame, subframe);
     		fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti);
     		fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index);
     		Msg3_transmitted(Mod_id, 0, frame, 0);
diff --git a/nfapi-L2-emulator-setup.txt b/targets/DOCS/nfapi-L2-emulator-setup.txt
similarity index 73%
rename from nfapi-L2-emulator-setup.txt
rename to targets/DOCS/nfapi-L2-emulator-setup.txt
index 4778577614423d119587a044497e8ccc495d2f49..3e502e2137edcf25450b06bef409b71bbac9882b 100644
--- a/nfapi-L2-emulator-setup.txt
+++ b/targets/DOCS/nfapi-L2-emulator-setup.txt
@@ -3,10 +3,10 @@
 source oaienv
 cd cmake_targets
 
-#Create lte-softmodem-stub-nos1 (UE) and lte-softmodem-nos1 (eNB) executables
-./build_oai --eNB --UE --noS1 -x -t ETHERNET -C
-cd lte_noS1_build_oai/build/
-make lte-softmodem-nos1
+#Create lte-uesoftmodem-nos1 (UE) and lte-softmodem-nos1 (eNB) executables
+./build_oai --UE --noS1 -x -t ETHERNET 
+
+./build_oai --eNB --noS1 -x -t ETHERNET
 
 -------------------------------------------------------------------------------------------------------------------------------------------------------
 
@@ -27,5 +27,5 @@ sudo ./lte-softmodem-nos1 -O PATH_OF:rcc.band7.tm1.50PRB.nfapi.conf
 
 # Run the UE process on the other terminal (PNF) (--L2-emul specifying the operation in nfapi-L2-emulation mode
 # and it has to be equal to 3, --num_ues specifying the number of UEs)
-sudo ./lte-softmodem-stub-nos1 -U -O PATH_OF:oaiL1.nfapi.usrpb210.conf --L2-emul 3 --num-ues 5 > debug_log.txt
+sudo ./lte-uesoftmodem-nos1 -U -O PATH_OF:oaiL1.nfapi.usrpb210.conf --L2-emul 3 --num-ues 5 > debug_log.txt
 
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 10ae59d8c657f192a758476e800939feec6892c2..5806f6872704cb52d521b942f28c234ac1acab4d 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -294,11 +294,6 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
   init_timer_thread();
   init_UE_single_thread_stub(nb_inst);
 
-  /*for (inst=0;inst<nb_inst;inst++) {
-
-    LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
-    init_UE_threads_stub(inst);
-  }*/
 
   printf("UE threads created \n");
 
@@ -899,18 +894,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
   phy_stub_ticking->ticking_var = -1;
   proc->subframe_rx=proc->sub_frame_start;
 
-  // Initialize all nfapi structures to NULL
-  /*for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
-      	UE_mac_inst[Mod_id].dl_config_req = NULL;
-      	UE_mac_inst[Mod_id].ul_config_req = NULL;
-      	UE_mac_inst[Mod_id].hi_dci0_req = NULL;
-      	//UE_mac_inst[Mod_id].ra_frame = 0;
-      	next_ra_frame = 0;
-      	next_Mod_id = 0;
-      	tx_request_pdu_list = NULL;
-      	tx_req_num_elems = 0;
-      	UE_mac_inst[Mod_id].tx_req = NULL;
-      }*/
 
   //PANOS: CAREFUL HERE!
   wait_sync("UE_phy_stub_single_thread_rxn_txnp4");
@@ -951,9 +934,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
       updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
 
 
-    //if(timer_frame%5 == 0 && timer_subframe%10 == 0)
-    	//init_ra_UE++;
-
     	//Panos: Not sure whether we should put the memory allocation here.
     	//*** Note we should find the right place to call free(UL_INFO).
     	UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
@@ -1008,40 +988,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
 
 
-      /*
-	#ifdef UE_SLOT_PARALLELISATION
-	phy_procedures_slot_parallelization_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
-	#else
-      */
-      // Panos: Substitute call to phy_procedures Rx with call to phy_stub functions in order to trigger
-      // UE Rx procedures directly at the MAC layer, based on the received nfapi requests from the vnf (eNB).
-      // Hardcode Mod_id for now. Will be changed later.
-
-      // Panos: is this the right place to call oai_subframe_indication to invoke p7 nfapi callbacks here?
-
-      //oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
-      //oai_subframe_ind(timer_frame, timer_subframe);
-
-      //start_meas(&UE->timer_stats);
-      //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
-
-
-
-      //oai_subframe_ind(timer_frame, timer_subframe);
-
-
       if(UE_mac_inst[Mod_id].dl_config_req!= NULL) {
-	//LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 3, NB_UE_INST:%d \n", NB_UE_INST);
+
 	dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req, Mod_id);
       }
-      //if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
       if (UE_mac_inst[Mod_id].hi_dci0_req!=NULL && UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
-    	  //LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 4 \n");
     	  hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req, Mod_id);
-    	  //if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
+
     		  free(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
     		  UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
-    	  //}
+
     	  free(UE_mac_inst[Mod_id].hi_dci0_req);
     	  UE_mac_inst[Mod_id].hi_dci0_req = NULL;
       }
@@ -1050,14 +1006,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
       		free(UE_mac_inst[Mod_id].hi_dci0_req);
       		UE_mac_inst[Mod_id].hi_dci0_req = NULL;
       	}
-      //stop_meas(&UE->timer_stats);
-      //t_diff = get_time_meas_us(&UE->timer_stats);
-      //LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
 
       if(nfapi_mode!=3)
       phy_procedures_UE_SL_TX(UE,proc);
 
-      //#endif
     }
 
 #if UE_TIMING_TRACE
@@ -1107,7 +1059,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     // We make the start of RA between consecutive UEs differ by 20 frames
 	//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH  && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
 	if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH  && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) {
-	  //LOG_D(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH \n");
 
 	  // check if we have PRACH opportunity
 
@@ -1116,11 +1067,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 	  // The one working strangely...
       //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
 
-	    //LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH 2 \n");
 	    PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
 	    if(prach_resources!=NULL ) {
 	    	UE_mac_inst[Mod_id].ra_frame = proc->frame_rx;
-	      LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH 3, Mod_id: %d \n", Mod_id );
+	      LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d \n", Mod_id );
 	      fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
 	      Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
 	      UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
@@ -1135,16 +1085,14 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 	// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
 	// Generate UL_indications which correspond to UL traffic.
 	if(UE_mac_inst[Mod_id].ul_config_req!= NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
-		//LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
 		ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req, timer_frame, timer_subframe, Mod_id);
-		//ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req, proc->frame_tx, proc->subframe_tx);
 		if(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
 			free(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list);
 			UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
 		}
 		free(UE_mac_inst[Mod_id].ul_config_req);
 		UE_mac_inst[Mod_id].ul_config_req = NULL;
-		//UL_indication(UL_INFO);
+
 	}
 	else if(UE_mac_inst[Mod_id].ul_config_req!=NULL){
 		free(UE_mac_inst[Mod_id].ul_config_req);
@@ -1155,25 +1103,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     phy_procedures_UE_SL_RX(UE,proc);
 
 
-    /*if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
-      (UE->frame_parms.frame_type == TDD))
-      if (UE->mode != loop_through_memory)
-      phy_procedures_UE_S_TX(UE,0,0,no_relay);
-      updateTimes(current, &t3, 10000, "Delay to process sub-frame (case 3)");*/
-
-    //if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
-    /*if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
-      LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
-      exit_fun("noting to add");
-    }
-
-    //proc->instance_cnt_rxtx--;
-
-    //if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
-    if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
-      LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXTX\n" );
-      exit_fun("noting to add");
-    }*/
     } //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
 
     if(tx_request_pdu_list!=NULL){
@@ -1185,33 +1114,32 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0)
       {
     	  //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
     	  oai_nfapi_crc_indication(&UL_INFO->crc_ind);
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.21 \n");
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n");
     	  UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
       }
       if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus>0)
       {
     	  //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.3 \n");
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
     	  oai_nfapi_rx_ind(&UL_INFO->rx_ind);
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.31 \n");
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
     	  UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
       }
       if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0)
       {
-    	  //LOG_D(MAC, "Panos-D: ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
+    	  //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
     	  oai_nfapi_harq_indication(&UL_INFO->harq_ind);
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.41 \n");
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
     	  UL_INFO->harq_ind.harq_indication_body.number_of_harqs =0;
 
       }
       if(UL_INFO->sr_ind.sr_indication_body.number_of_srs>0)
       {
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
     	  oai_nfapi_sr_indication(&UL_INFO->sr_ind);
-    	  //LOG_I(MAC, "Panos-D: ul_config_req_UE_MAC 2.51 \n");
+    	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
     	  UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
       }
 
@@ -1237,11 +1165,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
       UL_INFO = NULL;
 
 
-
-
-
-
-
   }
   // thread finished
   free(arg);
@@ -1310,15 +1233,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
     proc->frame_rx = timer_frame;
     proc->subframe_tx=(timer_subframe+4)%10;
     proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
-    //oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
-
-
-
-    // Panos: Guessing that the next 4 lines are not needed for the phy_stub mode.
-    /*initRefTimes(t2);
-      initRefTimes(t3);
-      pickTime(current);
-      updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
 
 
     // Process Rx data for one sub-frame
@@ -1347,33 +1261,12 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
 
       phy_procedures_UE_SL_RX(UE,proc);
 
-      /*
-	#ifdef UE_SLOT_PARALLELISATION
-	phy_procedures_slot_parallelization_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
-	#else
-      */
-      // Panos: Substitute call to phy_procedures Rx with call to phy_stub functions in order to trigger
-      // UE Rx procedures directly at the MAC layer, based on the received nfapi requests from the vnf (eNB).
-      // Hardcode Mod_id for now. Will be changed later.
-
-      // Panos: is this the right place to call oai_subframe_indication to invoke p7 nfapi callbacks here?
-
-      //oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
-      //oai_subframe_ind(timer_frame, timer_subframe);
-
-      //start_meas(&UE->timer_stats);
-      //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
-      oai_subframe_ind(timer_frame, timer_subframe);
-      //LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n");
-      //printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n");
-      /*if(UE_mac_inst[Mod_id].tx_req!= NULL){
-	printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 2\n");
-	tx_req_UE_MAC(UE_mac_inst[Mod_id].tx_req);
-	}*/
+       oai_subframe_ind(timer_frame, timer_subframe);
+
       if(UE_mac_inst[Mod_id].dl_config_req!= NULL) {
-	//LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 3 \n");
+
 	dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req, Mod_id);
-      //dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req, UE_mac_inst[Mod_id].tx_request_pdu_list);
+
       }
       //if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
       if (UE_mac_inst[Mod_id].hi_dci0_req!=NULL && UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
@@ -1391,14 +1284,10 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
       		free(UE_mac_inst[Mod_id].hi_dci0_req);
       		UE_mac_inst[Mod_id].hi_dci0_req = NULL;
       	}
-      //stop_meas(&UE->timer_stats);
-      //t_diff = get_time_meas_us(&UE->timer_stats);
-      //LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
 
       if (nfapi_mode != 3)
         phy_procedures_UE_SL_TX(UE,proc);
 
-      //#endif
     }
 
 #if UE_TIMING_TRACE
@@ -1450,10 +1339,8 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
 	  // check if we have PRACH opportunity
 
 	  if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
-	    //LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH 2 \n");
 	    PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
 	    if(prach_resources!=NULL) {
-	      //LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH 3 \n");
 	      fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
 	      Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
 	      UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
@@ -1466,16 +1353,14 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
 	// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
 	// Generate UL_indications which correspond to UL traffic.
 	if(UE_mac_inst[Mod_id].ul_config_req!= NULL && UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
-		//LOG_I(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
+		//LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
 		ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req, timer_frame, timer_subframe, Mod_id);
-		//ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req, proc->frame_tx, proc->subframe_tx);
 		if(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
 			free(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list);
 			UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
 		}
 		free(UE_mac_inst[Mod_id].ul_config_req);
 		UE_mac_inst[Mod_id].ul_config_req = NULL;
-		//UL_indication(UL_INFO);
 	}
 	else if(UE_mac_inst[Mod_id].ul_config_req!=NULL){
 		free(UE_mac_inst[Mod_id].ul_config_req);
@@ -1485,26 +1370,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
 
     phy_procedures_UE_SL_RX(UE,proc);
 
-
-    /*if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
-      (UE->frame_parms.frame_type == TDD))
-      if (UE->mode != loop_through_memory)
-      phy_procedures_UE_S_TX(UE,0,0,no_relay);
-      updateTimes(current, &t3, 10000, "Delay to process sub-frame (case 3)");*/
-
-    //if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
-    /*if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
-      LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
-      exit_fun("noting to add");
-    }
-
-    //proc->instance_cnt_rxtx--;
-
-    //if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
-    if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
-      LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXTX\n" );
-      exit_fun("noting to add");
-    }*/
   }
   // thread finished
   free(arg);
@@ -1873,16 +1738,6 @@ void init_UE_single_thread_stub(int nb_inst) {
     UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
     printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
     pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd);
-    /*
-      #ifdef UE_SLOT_PARALLELISATION
-      //pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot0_dl_processing,NULL);
-      //pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot0_dl_processing,NULL);
-      //pthread_create(&UE->proc.proc_rxtx[i].pthread_slot0_dl_processing,NULL,UE_thread_slot0_dl_processing, rtd);
-
-      pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot1_dl_processing,NULL);
-      pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot1_dl_processing,NULL);
-      pthread_create(&UE->proc.proc_rxtx[i].pthread_slot1_dl_processing,NULL,UE_thread_slot1_dl_processing, rtd);
-      #endif*/
 
   }
   // Panos: Remove thread for UE_sync in phy_stub_UE mode.
@@ -1935,16 +1790,7 @@ void init_UE_threads_stub(int inst) {
     UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
     printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
     pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_thread_rxn_txnp4, rtd);
-    /*
-      #ifdef UE_SLOT_PARALLELISATION
-      //pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot0_dl_processing,NULL);
-      //pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot0_dl_processing,NULL);
-      //pthread_create(&UE->proc.proc_rxtx[i].pthread_slot0_dl_processing,NULL,UE_thread_slot0_dl_processing, rtd);
 
-      pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot1_dl_processing,NULL);
-      pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot1_dl_processing,NULL);
-      pthread_create(&UE->proc.proc_rxtx[i].pthread_slot1_dl_processing,NULL,UE_thread_slot1_dl_processing, rtd);
-      #endif*/
 
   }
   // Panos: Remove thread for UE_sync in phy_stub_UE mode.
@@ -2025,9 +1871,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
-// which will be ticking and provide the SFN/SF values that will be used from the UE threads
-// playing the role of nfapi-pnf.
+
 
 /*static void* timer_thread( void* param ) {
   thread_top_init("timer_thread",1,870000L,1000000L,1000000L);
@@ -2192,7 +2036,9 @@ 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
+// which will be ticking and provide the SFN/SF values that will be used from the UE threads
+// playing the role of nfapi-pnf.
 
 //02/02/2018
 static void* timer_thread( void* param ) {
@@ -2207,22 +2053,8 @@ static void* timer_thread( void* param ) {
   int external_timer = 0;
 
 
-  //struct timespec pselect_start;
-
-
-  //struct timespec sf_duration;
-  //sf_duration.tv_sec = 0;
-  //sf_duration.tv_nsec = 1e6;
-
-
   wait_sync("timer_thread");
 
-  //pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL);
-  //pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL);
-
-  //  struct timespec start = {0};
-  //  struct timespec end = {0};
-  //sleepValue.tv_nsec = 1000000;
   opp_enabled = 1;
 
   // first check if we are receiving timing indications
@@ -2252,8 +2084,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_I(MAC, "Panos-D: timer_thread(), T_0 value: %" PRId64 "\n", T_0);
-  //printf("%" PRId64 "\n", t);
+  LOG_D(MAC, "Panos-D: timer_thread(), T_0 value: %" PRId64 "\n", T_0);
 
   while (!oai_exit) {
 
@@ -2266,8 +2097,7 @@ static void* timer_thread( void* param ) {
     } else {
       timer_subframe++;
     }
-    //printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe);
-    //LOG_I(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe);
+
     //AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), "");
     AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,"");
     phy_stub_ticking->ticking_var++;
@@ -2282,7 +2112,7 @@ static void* timer_thread( void* param ) {
       }
     }
     else
-    	LOG_I(MAC, "Panos-D: timer_thread() Timing problem! ticking_var value:%d \n \n \n", phy_stub_ticking->ticking_var);
+    	LOG_D(MAC, "timer_thread() Timing problem! ticking_var value:%d \n \n \n", phy_stub_ticking->ticking_var);
 
     AssertFatal(pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) ==0,"");
     start_meas(&UE->timer_stats);
@@ -2297,16 +2127,13 @@ static void* timer_thread( void* param ) {
     	if(T_now > T_next_SF){
     		t_sleep.tv_sec =0;
     	    t_sleep.tv_nsec =0;
-    		//T_sleep=0;
     	}
     	else{
     		T_sleep = T_next_SF - T_now;
-    		//LOG_I(MAC, "Panos-D: timer_thread(), T_sleep value: %" PRId64 "\n", T_sleep);
     		t_sleep.tv_sec =0;
     		t_sleep.tv_nsec = (__syscall_slong_t) T_sleep;
     	}
       nanosleep(&t_sleep, (struct timespec *)NULL);
-      //usleep(T_sleep/1000000);
       UE_tport_t pdu;
       pdu.header.packet_type = TTI_SYNC;
       pdu.header.absSF = (timer_frame*10)+timer_subframe;
@@ -2321,37 +2148,13 @@ static void* timer_thread( void* param ) {
       wait_on_condition(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread");
       release_thread(&UE->timer_mutex,&UE->instance_cnt_timer,"timer_thread");
     }
-    //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end);   // get final time-stamp
-
-    //double t_ns = (double)(end.tv_sec - start.tv_sec) * 1.0e9 +
-    //              (double)(end.tv_nsec - start.tv_nsec);
-    //printf("Panos-D: [timer_thread] REAL TIME difference: %f", t_ns);
 
 
     stop_meas(&UE->timer_stats);
     t_diff = get_time_meas_us(&UE->timer_stats);
 
-    //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now);
-    //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP);
-    //if (t_diff > 1100)
-
-
-    //    LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
-	    //LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
-
-    //printf("Panos-D: Absolute time: %f", t_diff);
-
-
     stop_meas(&UE->timer_stats);
     t_diff = get_time_meas_us(&UE->timer_stats);
-    //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now);
-    //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP);
-    //if (t_diff > 1100) LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
-    //printf("Panos-D: Absolute time: %f", t_diff);
-
-    //UE->proc.ticking_var++;
-    // pthread_cond_signal() //Send signal to ue_thread()?
-    // We also need to somehow pass the information of SFN/SF
   }
   free(phy_stub_ticking);
   pthread_cond_destroy(&phy_stub_ticking->cond_ticking);