diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 0d2ffbc2c326f4ecb65f522b9ef816e7a17bd0c7..fce01f04fd562867ccfc23a019e5440b234fae0a 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -85,6 +85,7 @@
 
 #include "T.h"
 #include "nfapi/oai_integration/vendor_ext.h"
+#include <nfapi/oai_integration/nfapi_pnf.h>
 //#define DEBUG_THREADS 1
 
 //#define USRP_DEBUG 1
@@ -92,17 +93,6 @@
 // extern openair0_device openair0;
 
 
-extern volatile int start_gNB;
-extern volatile int start_UE;
-extern volatile int oai_exit;
-
-extern openair0_config_t openair0_cfg[MAX_CARDS];
-
-extern int transmission_mode;
-
-extern uint16_t sf_ahead;
-extern uint16_t sl_ahead;
-
 //pthread_t                       main_gNB_thread;
 
 time_stats_t softmodem_stats_mt; // main thread
@@ -111,25 +101,13 @@ time_stats_t softmodem_stats_rxtx_sf; // total tx time
 time_stats_t nfapi_meas; // total tx time
 time_stats_t softmodem_stats_rx_sf; // total rx time
 
-extern double cpuf;
-
-void init_gNB(int,int);
-void stop_gNB(int nb_inst);
 
 #include "executables/thread-common.h"
-//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
-//extern WORKER_CONF_t   get_thread_worker_conf(void);
 
-extern uint8_t nfapi_mode;
-extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
-extern void oai_slot_ind(uint16_t sfn, uint16_t slot);
-extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
 
 //#define TICK_TO_US(ts) (ts.diff)
 #define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
 
-extern void init_td_thread(PHY_VARS_gNB *);
-extern void init_te_thread(PHY_VARS_gNB *);
 
 void tx_func(void *param) {
 
@@ -411,9 +389,6 @@ void kill_gNB_proc(int inst) {
   
 }
 
-
-
-
 void reset_opp_meas(void) {
   int sfn;
   reset_meas(&softmodem_stats_mt);
@@ -481,7 +456,6 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]);
      * (not tested in other modes).
      */
     //init_precoding_weights(RC.gNB[inst]);
-    //init_gNB_proc(inst);
     init_gNB_Tpool(inst);
   }
 
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 6dd798ff363edffdebda065398962e0407bf6b10..7a7be1de966909c23d3f2e61b6a9a9712b954d31 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -244,6 +244,9 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
 extern void set_softmodem_sighandler(void);
 extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
 extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+extern uint16_t sl_ahead;
+extern uint16_t sf_ahead;
+extern volatile int  oai_exit;
 
 void tx_func(void *param);
 void rx_func(void *param);
diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c
index cb6152385260942df9ebe89fd11ae3bd0f5cafa0..b45c1abf0b580fa187fec265ec5cd987d909660a 100644
--- a/openair1/PHY/TOOLS/nr_phy_scope.c
+++ b/openair1/PHY/TOOLS/nr_phy_scope.c
@@ -282,30 +282,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
   graph->iteration++;
 }
 
-static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
-  float *values, *time;
-  oai_xygraph_getbuff(graph, &time, &values, len, 0);
-
-  for (int ant=0; ant<nb_ant; ant++) {
-    if (data[ant] != NULL) {
-      float *values, *time;
-      oai_xygraph_getbuff(graph, &time, &values, len, ant);
-
-      for (int i=0; i<len; i+=8) {
-        float *vals=values+i;
-        const scopeSample_t *in=&(data[ant][i]);
-
-        // TRY AUTOMATIC simd BY GCC
-        for (int k=0; k<8; k++ ) {
-          vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
-        }
-      }
-
-      oai_xygraph(graph,time,values, len, ant, 10);
-    }
-  }
-}
-
 static void genericPowerPerAntena(OAIgraph_t  *graph, const int nb_ant, const scopeSample_t **data, const int len) {
   float *values, *time;
   oai_xygraph_getbuff(graph, &time, &values, len, 0);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 09691c6f9498a4a086c4c6c0df5cfa156df3c3e4..29fb5a141cd5b315ccd73a6d5ac588504f5aa786 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -79,8 +79,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
 
 double cpuf;
 
-int sf_ahead=4 ;
-int sl_ahead=0;
+uint16_t sf_ahead=4 ;
+uint16_t sl_ahead=0;
 //uint8_t nfapi_mode = 0;
 uint64_t downlink_frequency[MAX_NUM_CCs][4];
 
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index c90bcf1395d9dbd7755b30a3bd3b0b8c503de9e9..414270eec48ac80e30b0e1c653fbc15c0524407b 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -64,7 +64,7 @@ double cpuf;
 extern uint16_t prach_root_sequence_map0_3[838];
 openair0_config_t openair0_cfg[MAX_CARDS];
 //uint8_t nfapi_mode=0;
-int sl_ahead = 0;
+uint16_t sl_ahead = 0;
 
 //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
 
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 443ee6e1c0ccef6c04e347c99f8365902dc456ee..d1a9492629fa85b4e460f40c5bb7e13080505e4f 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -75,9 +75,9 @@ PHY_VARS_NR_UE *UE;
 RAN_CONTEXT_t RC;
 int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
 
-int sf_ahead=4 ;
+uint16_t sf_ahead=4 ;
 int slot_ahead=6 ;
-int sl_ahead=0;
+uint16_t sl_ahead=0;
 double cpuf;
 //uint8_t nfapi_mode = 0;
 uint64_t downlink_frequency[MAX_NUM_CCs][4];