diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
index 512be68669800472fb565e0d186015f3af5ccfd0..60cdba76aa442ed57e2c67d4c547ecf4fbc0abeb 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
@@ -1078,11 +1078,11 @@ int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMess
 
 
 int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg) {
-  int i,j, k;
+  int i; //,j, k;
   if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG)
     goto error;
 
-  Protocol__FlexUlDci *ul_dci;
+  // Protocol__FlexUlDci *ul_dci;
 
   free(msg->ul_mac_config_msg->header);
   for (i = 0; i < msg->ul_mac_config_msg->n_ul_ue_data; i++) {
@@ -1096,13 +1096,13 @@ int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg) {
   //     free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]);
   //   }
     // free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu);
-    ul_dci = msg->ul_mac_config_msg->ul_ue_data[i]->ul_dci;
+    // ul_dci = msg->ul_mac_config_msg->ul_ue_data[i]->ul_dci;
     // free(dl_dci->tbs_size);
     // free(ul_dci->mcs);
     // free(ul_dci->ndi);
     // free(ul_dci->rv);
     // free(ul_dci);
-    free(msg->ul_mac_config_msg->ul_ue_data[i]);
+    // free(msg->ul_mac_config_msg->ul_ue_data[i]);
   }
   free(msg->ul_mac_config_msg->ul_ue_data);
   
@@ -1269,7 +1269,7 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
   //xface->flexran_agent_send_update_mac_stats = NULL;
   xface->flexran_agent_schedule_ue_spec = NULL;
   xface->flexran_agent_get_pending_dl_mac_config = NULL;
-  
+  xface->flexran_agent_schedule_ul_spec = NULL;
 
   xface->dl_scheduler_loaded_lib = NULL;
   xface->ul_scheduler_loaded_lib = NULL;
diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
index 362c50f13cee3c2c61e06f80531d5b8cfb0a5d3c..10347f5587d4ee32fdbf828a7077e5ad8423fa67 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h
@@ -60,9 +60,10 @@ typedef struct {
   void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
 					 int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
   
-
- void (*flexran_agent_schedule_ul_spec)(mid_t module_idP,  uint32_t frameP, unsigned char cooperation_flag,
-        uint32_t subframeP, unsigned char sched_subframe, Protocol__FlexranMessage **ul_info);
+  /// Run the UE UL scheduler and fill the Protocol__FlexranMessage. Assumes that
+  
+ void (*flexran_agent_schedule_ul_spec)(mid_t module_idP,  uint32_t frameP, uint32_t cooperation_flag,
+        int subframeP, unsigned char sched_subframe, Protocol__FlexranMessage **ul_info);
 
   /// Notify the controller for a state change of a particular UE, by sending the proper
   /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c
index e3f96c05dccdba7444d7260faf9334715b729be4..e56ebdfd22fe55da3b63e7d682eedc744928e3e1 100644
--- a/openair2/ENB_APP/flexran_agent_common.c
+++ b/openair2/ENB_APP/flexran_agent_common.c
@@ -397,6 +397,11 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
   
   status = mkdir(local_cache, S_IRWXU | S_IRWXG | S_IRWXO);
 
+  if (status < 0){
+
+     LOG_W(ENB_APP, "Couldn't create local cache!");
+  }
+
   FILE *f;
   f = fopen(target, "wb");
   fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f);
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c
index 10b667e916a2de016f2c3dc8a0fba1f7f18f3b46..a22b6cb061ba84f469b045eff36faf165acbcff1 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.c
+++ b/openair2/ENB_APP/flexran_agent_ran_api.c
@@ -317,7 +317,7 @@ int flexran_get_harq(const mid_t mod_id,
 
    } else if (harq_flag == openair_harq_UL){
 
-     mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_UL);    
+     mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,round,openair_harq_UL);    
    }
    else {
 
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h
index 668c0e6ba0c3f48e32d7586efbc845071888d606..33def5e09a1663c4e50a5f3bc436a8d1d0530d9a 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.h
+++ b/openair2/ENB_APP/flexran_agent_ran_api.h
@@ -314,3 +314,6 @@ int flexran_agent_get_operating_pdsch_refpower (mid_t mod_id, int cc_id);
 
 /*Get uplink power*/
 int flexran_agent_get_operating_pusch_p0 (mid_t mod_id, int cc_id);
+
+/*RRC status flexRAN*/
+int flexran_get_rrc_status(const mid_t mod_id,  const rnti_t  rntiP);
\ No newline at end of file
diff --git a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h
index 5fc53fece6a7e2d215237309505097ffd8791e4e..59bef52dba57630051a5eb11cb137e1a75bbcf19 100644
--- a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h
+++ b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h
@@ -163,6 +163,15 @@ void _ulsch_scheduler_pre_processor(module_id_t module_idP,
                                    uint16_t *first_rb);
 
 
+void flexran_agent_schedule_ulsch_rnti(module_id_t   module_idP,
+                         unsigned char cooperation_flag,
+                         frame_t       frameP,
+                         sub_frame_t   subframeP,
+                         unsigned char sched_subframe,
+                         uint16_t     *first_rb);
+
+/* Downlink Primitives */
+
 void _dlsch_scheduler_pre_processor (module_id_t   Mod_id,
 				     int           slice_id,
 				     frame_t       frameP,
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c
index 02fe873144f717491c6a4bc6f873d081c37a8c8e..601310d67a4e5de5d58523b55c3e36ae8ef48512 100644
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c
+++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c
@@ -788,7 +788,7 @@ flexran_schedule_ue_dl_spec_default(mid_t   mod_id,
 	slice_maxmcs_current[i] = slice_maxmcs[i];
 
       } else {
-	LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i,  slice_percentage[i],slice_percentage[i]);
+	// LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i, slice_maxmcs[i],slice_percentage[i]);
 
 	slice_maxmcs[i]= slice_maxmcs_current[i];
 
@@ -1253,7 +1253,7 @@ flexran_schedule_ue_dl_spec_common(mid_t   mod_id,
 	  header_len += 3;
 	  // Need to see if we have space for data from this channel
 	  if (dci_tbs - ta_len - header_len - sdu_length_total > 0) {
-	     LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len);
+	     LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len, j);
 	     //If we have space, we need to see how much data we can request at most (if any available)
 	     rlc_status = mac_rlc_status_ind(mod_id,
 					     rnti,
diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_ulsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_ulsch_ue.c
index 4038ae518b2db5e9f056a8e9c2a12afd5e5e5429..5b31c11681e619156209204a5cb55436ef903b44 100644
--- a/openair2/LAYER2/MAC/flexran_agent_scheduler_ulsch_ue.c
+++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_ulsch_ue.c
@@ -49,14 +49,22 @@
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 
 //#include "LAYER2/MAC/pre_processor.c"
+#include "ENB_APP/flexran_agent_defs.h"
+#include "flexran_agent_ran_api.h"
 #include "pdcp.h"
 
+#include "header.pb-c.h"
+#include "flexran.pb-c.h"
+#include "flexran_agent_mac.h"
+
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
 #endif
 
 #include "T.h"
 
+#include <dlfcn.h>
+
 /* number of active slices for  past and current time*/
 int n_active_slices_uplink = 1;
 int n_active_slices_uplink_current = 1;
@@ -222,7 +230,7 @@ void _ulsch_scheduler_pre_processor(module_id_t module_idP,
   rnti_t             rnti= -1;
   UE_list_t          *UE_list = &eNB_mac_inst[module_idP].UE_list;
   UE_TEMPLATE        *UE_template = 0;
-  LTE_DL_FRAME_PARMS   *frame_parms = 0;
+  // LTE_DL_FRAME_PARMS   *frame_parms; //Not used yet
   UE_sched_ctrl *ue_sched_ctl;
   
 
@@ -272,7 +280,7 @@ void _ulsch_scheduler_pre_processor(module_id_t module_idP,
       CC_id = UE_list->ordered_ULCCids[n][UE_id];
       UE_template = &UE_list->UE_template[CC_id][UE_id];
       average_rbs_per_user[CC_id]=0;
-      frame_parms = mac_xface->get_lte_frame_parms(module_idP,CC_id);
+      // frame_parms = mac_xface->get_lte_frame_parms(module_idP,CC_id);
 
       if (UE_template->pre_allocated_nb_rb_ul > 0) {
         total_ue_count+=1;
@@ -359,7 +367,7 @@ void _ulsch_scheduler_pre_processor(module_id_t module_idP,
         // This is the actual CC_id in the list
         CC_id = UE_list->ordered_ULCCids[n][UE_id];
         UE_template = &UE_list->UE_template[CC_id][UE_id];        
-        frame_parms = mac_xface->get_lte_frame_parms(module_idP,CC_id);
+        // frame_parms = mac_xface->get_lte_frame_parms(module_idP,CC_id);
         total_remaining_rbs[CC_id]=nb_rbs_allowed_slice_uplink[CC_id][UE_id] - first_rb[CC_id] - total_allocated_rbs[CC_id];
 
         if (total_ue_count == 1 ) {
@@ -384,7 +392,7 @@ void _ulsch_scheduler_pre_processor(module_id_t module_idP,
   }
 
   for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
-    frame_parms= mac_xface->get_lte_frame_parms(module_idP,CC_id);
+    // frame_parms= mac_xface->get_lte_frame_parms(module_idP,CC_id);
 
     if (total_allocated_rbs[CC_id]>0) {
       LOG_D(MAC,"[eNB %d] total RB allocated for all UEs = %d/%d\n", module_idP, total_allocated_rbs[CC_id], nb_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]);