diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index d21c9245ae70360bc12f360278db22317755d53e..c72dd8cad11dc953a52ad787c07761aec4fc35c9 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -572,16 +572,17 @@ void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t harq_list[2][NR_MAX_DLSCH_HARQ_PR
 
       harq_list[j][i].c = malloc16(a_segments*sizeof(uint8_t *));
       harq_list[j][i].d = malloc16(a_segments*sizeof(int16_t *));
+      const int sz=5*8448*sizeof(int16_t);
       for (int r=0; r<a_segments; r++) {
         harq_list[j][i].c[r] = malloc16(1056);
-        harq_list[j][i].d[r] = malloc16(5*8448*sizeof(int16_t));
+        harq_list[j][i].d[r] = malloc16(sz);
         if (harq_list[j][i].c[r])
           memset(harq_list[j][i].c[r],0,1056);
         else
           AssertFatal(true, "Unable to reset harq memory \"c\"\n");
 
         if (harq_list[j][i].d[r])
-          memset(harq_list[j][i].d[r],0,5*8448);
+          memset(harq_list[j][i].d[r], 0, sz);
         else
           AssertFatal(true, "Unable to reset harq memory \"d\"\n");
       }
diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h
index c5bc4f880e615382edf41f809fd6a06883fed0cb..ea098d088bf26d8001392052687ab7ec1a689481 100644
--- a/openair1/PHY/NR_REFSIG/pss_nr.h
+++ b/openair1/PHY/NR_REFSIG/pss_nr.h
@@ -37,12 +37,6 @@
 
 #include "PHY/NR_REFSIG/ss_pbch_nr.h"
 
-#ifdef DEFINE_VARIABLES_PSS_NR_H
-#define EXTERN
-#else
-#define EXTERN  extern
-#endif
-
 /************** CODE GENERATION ***********************************/
 
 //#define PSS_DECIMATOR                          /* decimation of sample is done between time correlation */
@@ -81,55 +75,10 @@
 #define SYNC_TMP_SIZE                  (NB_ANTENNAS_RX*SYNCHRO_FFT_SIZE_MAX*IQ_SIZE) /* to be aligned with existing lte synchro */
 #define SYNCF_TMP_SIZE                 (SYNCHRO_FFT_SIZE_MAX*IQ_SIZE)
 
-/************* STRUCTURES *****************************************/
-
-
-/************** VARIABLES *****************************************/
-
-//#define STATIC_SYNC_BUFFER
-
-#ifdef STATIC_SYNC_BUFFER
-/* buffer defined in file lte_sync_time */
-EXTERN int16_t synchro_tmp[SYNC_TMP_SIZE]   __attribute__((aligned(32)));
-EXTERN int16_t synchroF_tmp[SYNCF_TMP_SIZE] __attribute__((aligned(32)));
-#else
-EXTERN int16_t *synchro_tmp;
-EXTERN int16_t *synchroF_tmp;
-#endif
-
-EXTERN int16_t *primary_synchro_nr[NUMBER_PSS_SEQUENCE]
-#ifdef INIT_VARIABLES_PSS_NR_H
-= { NULL, NULL, NULL}
-#endif
-;
-EXTERN int16_t *primary_synchro_nr2[NUMBER_PSS_SEQUENCE]
-#ifdef INIT_VARIABLES_PSS_NR_H
-= { NULL, NULL, NULL}
-#endif
-;
-EXTERN int16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE]
-#ifdef INIT_VARIABLES_PSS_NR_H
-= { NULL, NULL, NULL}
-#endif
-;
-
-/* profiling structure */
-EXTERN time_stats_t generic_time[TIME_LAST];
-
-#ifndef DEFINE_HEADER_ONLY
-
-/************** FUNCTION ******************************************/
-
 void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue);
 void free_context_synchro_nr(void);
-void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue);
-void free_context_pss_nr(void);
-int set_pss_nr(int ofdm_symbol_size);
 int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change);
-int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is);
-
-#endif
-#undef EXTERN
+int16_t *get_primary_synchro_nr2(const int nid2);
 
 #endif /* PSS_NR_H */
 
diff --git a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
index 5572604e5559e085a91176239d91c56821334538..ad96054c1259d8af2728739781c2f41bce887840 100644
--- a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
+++ b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
@@ -67,7 +67,7 @@
 #define  NB_SYMBOLS_PBCH              (3)
 #define  NR_N_SYMBOLS_SSB             (4)
 
-#define  IQ_SIZE                      (sizeof(int16_t) * 2)        /* I and Q are alternatively stored into buffers */
+#define IQ_SIZE sizeof(c16_t) /* I and Q are alternatively stored into buffers */
 #define  N_SYMB_SLOT                  (14)
 
 /* SS/PBCH parameters :  see from TS 38.211 table 7.4.3.1-1: Resources within an SS/PBCH block for PSS... */
diff --git a/openair1/PHY/NR_REFSIG/sss_nr.h b/openair1/PHY/NR_REFSIG/sss_nr.h
index 212ee59c1d13e05a8429a1c9868c7abbc07c779c..7303d99d3b219981cd929db0647f9ced00ff1e2b 100644
--- a/openair1/PHY/NR_REFSIG/sss_nr.h
+++ b/openair1/PHY/NR_REFSIG/sss_nr.h
@@ -38,13 +38,6 @@
 
 #include "pss_nr.h"
 
-#ifdef DEFINE_VARIABLES_SSS_NR_H
-#define EXTERN
-#define INIT_VARIABLES_SSS_NR_H
-#else
-#define EXTERN  extern
-#endif
-
 /************** DEFINE ********************************************/
 
 #define  SAMPLES_IQ                   (sizeof(int16_t)*2)
@@ -64,26 +57,7 @@
 /************** VARIABLES *****************************************/
 
 #define PHASE_HYPOTHESIS_NUMBER       (16)
-#define INDEX_NO_PHASE_DIFFERENCE     (3)          /* this is for no phase shift case */
-
-EXTERN const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
-#ifdef INIT_VARIABLES_SSS_NR_H
-// -pi/3 ---- pi/3
-= {16384,20173,23571,26509,28932,30791,32051,32687,32687,32051,30791,
-   28932,26509,23571,20173,16384}
-#endif
-;
-
-EXTERN const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER]
-#ifdef INIT_VARIABLES_SSS_NR_H
-// -pi/3 ---- pi/3
-= {-28377,-25821,-22762,-19260,-15383,-11207,-6813,-2286,2286,6813,11207,
-   15383,19260,22762,25821,28377}
-#endif
-;
-
-EXTERN int16_t d_sss[N_ID_2_NUMBER][N_ID_1_NUMBER][LENGTH_SSS_NR];
-
+#define INDEX_NO_PHASE_DIFFERENCE (3) /* this is for no phase shift case */
 /************** FUNCTION ******************************************/
 
 void init_context_sss_nr(int amp);
@@ -92,14 +66,11 @@ void free_context_sss_nr(void);
 void insert_sss_nr(int16_t *sss_time,
                    NR_DL_FRAME_PARMS *frame_parms);
 
-int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
-                  int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
-                  int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR]);
-
-int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
-
-#undef INIT_VARIABLES_SSS_NR_H
-#undef EXTERN
-
+int rx_sss_nr(PHY_VARS_NR_UE *ue,
+              UE_nr_rxtx_proc_t *proc,
+              int32_t *tot_metric,
+              uint8_t *phase_max,
+              int *freq_offset_sss,
+              c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
 #endif /* SSS_NR_H */
 
diff --git a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c
index 202e0580149b6cb470303c69dacef06e491be44e..15ddc58ab56ba78cf0064cf258775bb5eb82d475 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c
@@ -22,7 +22,8 @@
 #include "nr_transport_common_proto.h"
 #include "PHY/NR_REFSIG/nr_refsig.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
-
+#define DEBUG_SCRAMBLING(a)
+//#define DEBUG_SCRAMBLING(a) a
 void nr_codeword_scrambling(uint8_t *in,
                             uint32_t size,
                             uint8_t q,
@@ -39,7 +40,7 @@ void nr_codeword_scrambling(uint8_t *in,
     __m256i c = ((__m256i*)in)[i];
     uint32_t in32 = simde_mm256_movemask_epi8(simde_mm256_slli_epi16(c,7));
     out[i]=(in32^s);
-    LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]);
+    DEBUG_SCRAMBLING(LOG_D(PHY, "in[%d] %x => %x\n", i, in32, out[i]));
     s=lte_gold_generic(&x1, &x2, 0);
   }
 }
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
index e81f8551c08d940699f2aa493c2be582c908ff72..d2ecc561779718efd2c5c32c5cc9badfc9957355 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
@@ -254,7 +254,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
     ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
 
 #ifdef DEBUG_INITIAL_SYNCH
-    LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
+    LOG_I(PHY, "[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos, ue->common_vars.nid2);
     LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
 #endif
 
@@ -453,7 +453,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
   } else {
 #ifdef DEBUG_INITIAL_SYNC
     LOG_I(PHY,"[UE%d] Initial sync : PBCH not ok\n",ue->Mod_id);
-    LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",ue->Mod_id,sync_pos,ue->common_vars.eNb_id);
+    LOG_I(PHY, "[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos, ue->common_vars.nid2);
     LOG_I(PHY,"[UE%d] Initial sync : Estimated Nid_cell %d, Frame_type %d\n",ue->Mod_id,
           frame_parms->Nid_cell,frame_parms->frame_type);
 #endif
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
index 50f6fa2f34af542be01da7d22b1239b21dea1bf6..48486bbdee7c10663fd06867283546e8c4de300e 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
@@ -49,6 +49,15 @@
 #include "PHY/NR_UE_TRANSPORT/cic_filter_nr.h"
 
 //#define DBG_PSS_NR
+static time_stats_t generic_time[TIME_LAST];
+static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is);
+
+static int16_t *primary_synchro_nr2[NUMBER_PSS_SEQUENCE] = {0};
+static c16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE] = {0};
+int16_t *get_primary_synchro_nr2(const int nid2)
+{
+  return primary_synchro_nr2[nid2];
+}
 
 /*******************************************************************
 *
@@ -70,47 +79,28 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
   AssertFatal(N_ID_2>=0 && N_ID_2 <=2,"Illegal N_ID_2 %d\n",N_ID_2);
   int16_t d_pss[LENGTH_PSS_NR];
   int16_t x[LENGTH_PSS_NR];
-  int16_t *primary_synchro_time = primary_synchro_time_nr[N_ID_2];
-  unsigned int length = fp->ofdm_symbol_size;
-  unsigned int size = length * IQ_SIZE; /* i & q */
-  int16_t *primary_synchro = primary_synchro_nr[N_ID_2]; /* pss in complex with alternatively i then q */
-  int16_t *primary_synchro2 = primary_synchro_nr2[N_ID_2]; /* pss in complex with alternatively i then q */
 
+  c16_t primary_synchro[LENGTH_PSS_NR] = {0};
+  int16_t *primary_synchro2 = primary_synchro_nr2[N_ID_2]; /* pss in complex with alternatively i then q */
 
-  #define INITIAL_PSS_NR    (7)
-  const int x_initial[INITIAL_PSS_NR] = {0, 1, 1 , 0, 1, 1, 1};
-
+#define INITIAL_PSS_NR (7)
+  const int16_t x_initial[INITIAL_PSS_NR] = {0, 1, 1, 0, 1, 1, 1};
   assert(N_ID_2 < NUMBER_PSS_SEQUENCE);
-  assert(size <= SYNCF_TMP_SIZE);
-  assert(size <= SYNC_TMP_SIZE);
-
-  bzero(synchroF_tmp, size);
-  bzero(synchro_tmp, size);
-
-  for (int i=0; i < INITIAL_PSS_NR; i++) {
-    x[i] = x_initial[i];
-  }
+  memcpy(x, x_initial, sizeof(x_initial));
 
   for (int i=0; i < (LENGTH_PSS_NR - INITIAL_PSS_NR); i++) {
     x[i+INITIAL_PSS_NR] = (x[i + 4] + x[i])%(2);
   }
 
   for (int n=0; n < LENGTH_PSS_NR; n++) {
-    int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR);
+    const int m = (n + 43 * N_ID_2) % (LENGTH_PSS_NR);
     d_pss[n] = 1 - 2*x[m];
   }
 
   /* PSS is directly mapped to subcarrier without modulation 38.211 */
   for (int i=0; i < LENGTH_PSS_NR; i++) {
-#if 1
-    primary_synchro[2*i] = (d_pss[i] * SHRT_MAX)>>SCALING_PSS_NR; /* Maximum value for type short int ie int16_t */
-    primary_synchro[2*i+1] = 0;
-    primary_synchro2[i] = d_pss[i];
-#else
-    primary_synchro[2*i] = d_pss[i] * AMP;
-    primary_synchro[2*i+1] = 0;
+    primary_synchro[i].r = (d_pss[i] * SHRT_MAX) >> SCALING_PSS_NR; /* Maximum value for type short int ie int16_t */
     primary_synchro2[i] = d_pss[i];
-#endif
   }
 
 #ifdef DBG_PSS_NR
@@ -118,8 +108,8 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
   if (N_ID_2 == 0) {
     char output_file[255];
     char sequence_name[255];
-    sprintf(output_file, "pss_seq_%d_%u.m", N_ID_2, length);
-    sprintf(sequence_name, "pss_seq_%d_%u", N_ID_2, length);
+    sprintf(output_file, "pss_seq_%d_%u.m", N_ID_2, fp->ofdm_symbol_size);
+    sprintf(sequence_name, "pss_seq_%d_%u", N_ID_2, fp->ofdm_symbol_size);
     printf("file %s sequence %s\n", output_file, sequence_name);
 
     LOG_M(output_file, sequence_name, primary_synchro, LENGTH_PSS_NR, 1, 1);
@@ -151,31 +141,18 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
 
   unsigned int  k = fp->first_carrier_offset + fp->ssb_start_subcarrier + 56; //and
   if (k>= fp->ofdm_symbol_size) k-=fp->ofdm_symbol_size;
-
-
+  c16_t synchroF_tmp[fp->ofdm_symbol_size] __attribute__((aligned(32)));
+  memset(synchroF_tmp, 0, sizeof(synchroF_tmp));
   for (int i=0; i < LENGTH_PSS_NR; i++) {
-    synchroF_tmp[2*k] = primary_synchro[2*i];
-    synchroF_tmp[2*k+1] = primary_synchro[2*i+1];
-
+    synchroF_tmp[k % fp->ofdm_symbol_size] = primary_synchro[i];
     k++;
-
-    if (k == length) k=0;
-    
   }
 
   /* IFFT will give temporal signal of Pss */
-
- 
- 
-  idft((int16_t)get_idft(length),
-  	   synchroF_tmp,          /* complex input */
-       synchro_tmp,           /* complex output */
-       1);                 /* scaling factor */
-
-  /* then get final pss in time */
-  for (unsigned int i=0; i<length; i++) {
-    ((int32_t *)primary_synchro_time)[i] = ((int32_t *)synchro_tmp)[i];
-  }
+  idft((int16_t)get_idft(fp->ofdm_symbol_size),
+       (int16_t *)synchroF_tmp, /* complex input but legacy type is wrong*/
+       (int16_t *)primary_synchro_time_nr[N_ID_2], /* complex output */
+       1); /* scaling factor */
 
 #ifdef DBG_PSS_NR
 
@@ -226,12 +203,12 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
 #define LIMIT_ERROR_FFT   (10)
 
     for (int i=0; i < LENGTH_PSS_NR; i++) {
-      if (abs(synchroF_tmp[2*k] - primary_synchro[2*i]) > LIMIT_ERROR_FFT) {
-      printf("Pss Error[%d] Compute %d Reference %d \n", k, synchroF_tmp[2*k], primary_synchro[2*i]);
+      if (abs(synchroF_tmp[2*k] - primary_synchro[i].r) > LIMIT_ERROR_FFT) {
+      printf("Pss Error[%d] Compute %d Reference %d \n", k, synchroF_tmp[2*k], primary_synchro[i].r);
       }
     
-      if (abs(synchroF_tmp[2*k+1] - primary_synchro[2*i+1]) > LIMIT_ERROR_FFT) {
-        printf("Pss Error[%d] Compute %d Reference %d\n", (2*k+1), synchroF_tmp[2*k+1], primary_synchro[2*i+1]);
+      if (abs(synchroF_tmp[2*k+1] - primary_synchro[i].i) > LIMIT_ERROR_FFT) {
+        printf("Pss Error[%d] Compute %d Reference %d\n", (2*k+1), synchroF_tmp[2*k+1], primary_synchro[i].i);
       }
 
       k++;
@@ -257,40 +234,14 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2)
 *
 *********************************************************************/
 
-void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
+static void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
 {
-  int ofdm_symbol_size = frame_parms_ue->ofdm_symbol_size;
-  int sizePss = LENGTH_PSS_NR * IQ_SIZE;  /* complex value i & q signed 16 bits */
-  int size = ofdm_symbol_size * IQ_SIZE; /* i and q samples signed 16 bits */
-  int16_t *p = NULL;
-
-  AssertFatal(ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n",ofdm_symbol_size);
+  AssertFatal(frame_parms_ue->ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n", frame_parms_ue->ofdm_symbol_size);
   for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
-
-    p = malloc16(sizePss); /* pss in complex with alternatively i then q */
-    if (p != NULL) {
-      primary_synchro_nr[i] = p;
-      bzero( primary_synchro_nr[i], sizePss);
-    }
-    else {
-      LOG_E(PHY,"Fatal memory allocation problem \n");
-      assert(0);
-    }
-    p = malloc(LENGTH_PSS_NR*2);
-    if (p != NULL) {
-      primary_synchro_nr2[i] = p;
-      bzero( primary_synchro_nr2[i],LENGTH_PSS_NR*2);
-    }
-    p = malloc16(size);
-    if (p != NULL) {
-      primary_synchro_time_nr[i] = p;
-      bzero( primary_synchro_time_nr[i], size);
-    }
-    else {
-      LOG_E(PHY,"Fatal memory allocation problem \n");
-     assert(0);
-    }
-
+    primary_synchro_nr2[i] = malloc16_clear(LENGTH_PSS_NR * sizeof(int16_t));
+    AssertFatal(primary_synchro_nr2[i], "Fatal memory allocation problem \n");
+    primary_synchro_time_nr[i] = malloc16_clear(frame_parms_ue->ofdm_symbol_size * sizeof(c16_t));
+    AssertFatal(primary_synchro_time_nr[i], "Fatal memory allocation problem \n");
     generate_pss_nr(frame_parms_ue,i);
   }
 }
@@ -307,10 +258,9 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
 *
 *********************************************************************/
 
-void free_context_pss_nr(void)
+static void free_context_pss_nr(void)
 {
   for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
-    free_and_zero(primary_synchro_nr[i]);
     free_and_zero(primary_synchro_nr2[i]);
     free_and_zero(primary_synchro_time_nr[i]);
   }
@@ -330,25 +280,8 @@ void free_context_pss_nr(void)
 
 void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
 {
-#ifndef STATIC_SYNC_BUFFER
-
   /* initialise global buffers for synchronisation */
-  synchroF_tmp = malloc16(SYNCF_TMP_SIZE);
-  if (synchroF_tmp == NULL) {
-    LOG_E(PHY,"Fatal memory allocation problem \n");
-    assert(0);
-  }
-
-  synchro_tmp = malloc16(SYNC_TMP_SIZE);
-  if (synchro_tmp == NULL) {
-    LOG_E(PHY,"Fatal memory allocation problem \n");
-    assert(0);
-  }
-
-#endif
-
   init_context_pss_nr(frame_parms_ue);
-
   init_context_sss_nr(AMP);
 }
 
@@ -366,28 +299,6 @@ void init_context_synchro_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
 
 void free_context_synchro_nr(void)
 {
-#ifndef STATIC_SYNC_BUFFER
-
-  if (synchroF_tmp != NULL) {
-    free(synchroF_tmp);
-    synchroF_tmp = NULL;
-  }
-  else {
-    LOG_E(PHY,"Fatal memory deallocation problem \n");
-    assert(0);
-  }
-
-  if (synchro_tmp != NULL) {
-    free(synchro_tmp);
-    synchro_tmp = NULL;
-  }
-  else {
-    LOG_E(PHY,"Fatal memory deallocation problem \n");
-    assert(0);
-  }
-
-#endif
-
   free_context_pss_nr();
 }
 
@@ -647,10 +558,10 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
 *
 *********************************************************************/
 
-int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
+static int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
 {
   NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
-  int *eNB_id = (int *)&ue->common_vars.eNb_id;
+  int *nid2 = (int *)&ue->common_vars.nid2;
   int *f_off = (int *)&ue->common_vars.freq_offset;
   unsigned int n, ar, peak_position, pss_source;
   int64_t peak_value;
@@ -672,14 +583,11 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
   pss_source = 0;
 
   int maxval=0;
-  for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) {
-    maxval = max(maxval,primary_synchro_time_nr[0][i]);
-    maxval = max(maxval,-primary_synchro_time_nr[0][i]);
-    maxval = max(maxval,primary_synchro_time_nr[1][i]);
-    maxval = max(maxval,-primary_synchro_time_nr[1][i]);
-    maxval = max(maxval,primary_synchro_time_nr[2][i]);
-    maxval = max(maxval,-primary_synchro_time_nr[2][i]);
-  }
+  for (int j = 0; j < NUMBER_PSS_SEQUENCE; j++)
+    for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
+      maxval = max(maxval, abs(primary_synchro_time_nr[j][i].r));
+      maxval = max(maxval, abs(primary_synchro_time_nr[j][i].i));
+    }
   int shift = log2_approx(maxval);//*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*2);
 
   /* Search pss in the received buffer each 4 samples which ensures a memory alignment on 128 bits (32 bits x 4 ) */
@@ -702,7 +610,10 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
       for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) {
 
         /* perform correlation of rx data and pss sequence ie it is a dot product */
-        const c32_t result = dot_product((c16_t *)primary_synchro_time_nr[pss_index], &(rxdata[ar][n + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size, shift);
+        const c32_t result = dot_product(primary_synchro_time_nr[pss_index],
+                                         &(rxdata[ar][n + is * frame_parms->samples_per_frame]),
+                                         frame_parms->ofdm_symbol_size,
+                                         shift);
         const c64_t r64 = {.r = result.r, .i = result.i};
         pss_corr_ue += squaredMod(r64);
         //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0];   /* real part */
@@ -732,10 +643,13 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
 	  // Shoujun Huang, Yongtao Su, Ying He and Shan Tang, "Joint time and frequency offset estimation in LTE downlink," 7th International Conference on Communications and Networking in China, 2012.
 
     // Computing cross-correlation at peak on half the symbol size for first half of data
-    c32_t r1 = dot_product((c16_t *)primary_synchro_time_nr[pss_source], &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size >> 1, shift);
+    c32_t r1 = dot_product(primary_synchro_time_nr[pss_source],
+                           &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]),
+                           frame_parms->ofdm_symbol_size >> 1,
+                           shift);
     // Computing cross-correlation at peak on half the symbol size for data shifted by half symbol size
     // as it is real and complex it is necessary to shift by a value equal to symbol size to obtain such shift
-    c32_t r2 = dot_product((c16_t *)primary_synchro_time_nr[pss_source] + (frame_parms->ofdm_symbol_size >> 1),
+    c32_t r2 = dot_product(primary_synchro_time_nr[pss_source] + (frame_parms->ofdm_symbol_size >> 1),
                            &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]) + (frame_parms->ofdm_symbol_size >> 1),
                            frame_parms->ofdm_symbol_size >> 1,
                            shift);
@@ -754,7 +668,7 @@ int pss_search_time_nr(c16_t **rxdata, PHY_VARS_NR_UE *ue, int fo_flag, int is)
   for (int pss_index = pss_index_start; pss_index < pss_index_end; pss_index++)
     avg[pss_index] /= (length / 4);
 
-  *eNB_id = pss_source;
+  *nid2 = pss_source;
 
   LOG_I(PHY,"[UE] nr_synchro_time: Sync source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf\n", pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est);
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
index cdb45fc9c1cc518d8f3238201753e41de4250049..2f53a7b95d1a682eada905ad6f44f8e58c9ab1c8 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
@@ -63,6 +63,15 @@
 
 #define INITIAL_SSS_NR    (7)
 
+static const int16_t phase_re_nr[PHASE_HYPOTHESIS_NUMBER]
+    // -pi/3 ---- pi/3
+    = {16384, 20173, 23571, 26509, 28932, 30791, 32051, 32687, 32687, 32051, 30791, 28932, 26509, 23571, 20173, 16384};
+
+static const int16_t phase_im_nr[PHASE_HYPOTHESIS_NUMBER] // -pi/3 ---- pi/3
+    = {-28377, -25821, -22762, -19260, -15383, -11207, -6813, -2286, 2286, 6813, 11207, 15383, 19260, 22762, 25821, 28377};
+
+static int16_t d_sss[N_ID_2_NUMBER][N_ID_1_NUMBER][LENGTH_SSS_NR];
+
 void init_context_sss_nr(int amp)
 {
   int16_t x0[LENGTH_SSS_NR];
@@ -132,15 +141,7 @@ void init_context_sss_nr(int amp)
 void insert_sss_nr(int16_t *sss_time,
                    NR_DL_FRAME_PARMS *frame_parms)
 {
-  unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
-  unsigned int size = ofdm_symbol_size * IQ_SIZE; /* i & q */
-
-  assert(size <= SYNCF_TMP_SIZE);
-  assert(size <= SYNC_TMP_SIZE);
-
-  bzero(synchroF_tmp, size);
-  bzero(synchro_tmp, size);
-
+  const unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
   int Nid2 = GET_NID2(frame_parms->Nid_cell);
   int Nid1 = GET_NID1(frame_parms->Nid_cell);
 
@@ -167,29 +168,24 @@ void insert_sss_nr(int16_t *sss_time,
     */
 
   unsigned int k = ofdm_symbol_size - ((LENGTH_SSS_NR/2)+1);
+  c16_t synchroF_tmp[2048] __attribute__((aligned(32)));
+  c16_t synchro_tmp[2048] __attribute__((aligned(32)));
+  bzero(synchroF_tmp, sizeof(synchroF_tmp));
 
   /* SSS is directly mapped to subcarrier */
   for (int i=0; i<LENGTH_SSS_NR; i++) {
-    synchroF_tmp[2*k] = d_sss[Nid2][Nid1][i];
-    synchroF_tmp[2*k+1] = 0;
-
+    synchroF_tmp[k % ofdm_symbol_size].r = d_sss[Nid2][Nid1][i];
     k++;
-
-    if (k >= ofdm_symbol_size) {
-      k++;
-      k-=ofdm_symbol_size;
-    }
   }
 
   /* get sss in the frequency domain by applying an inverse FFT */
-  idft(IDFT_2048,synchroF_tmp,          /* complex input */
-           synchro_tmp,           /* complex output */
-   	   1);                    /* scaling factor */
+  idft(IDFT_2048,
+       (int16_t *)synchroF_tmp, /* complex input */
+       (int16_t *)synchro_tmp, /* complex output */
+       1); /* scaling factor */
 
   /* then get final sss in time */
-  for (unsigned int i=0; i<ofdm_symbol_size; i++) {
-    ((int32_t *)sss_time)[i] = ((int32_t *)synchro_tmp)[i];
-  }
+  memcpy(sss_time, synchro_tmp, ofdm_symbol_size * sizeof(c16_t));
 }
 
 /*******************************************************************
@@ -204,81 +200,34 @@ void insert_sss_nr(int16_t *sss_time,
 *
 *********************************************************************/
 
-int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
-                  int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
-                  int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR])
+static int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
+                         c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
+                         c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR])
 {
-  int16_t *pss;
-  int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2;
-  uint8_t aarx,i;
-  NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
-
-  pss = primary_synchro_nr2[ue->common_vars.eNb_id];
-
-  sss_ext3 = (int16_t*)&sss_ext[0][0];
-
-#if 0
-  int16_t chest[2*LENGTH_PSS_NR];
-#endif
-
-  for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
-
-    sss_ext2 = (int16_t*)&sss_ext[aarx][0];
-    pss_ext2 = (int16_t*)&pss_ext[aarx][0];
-
-
-#if 0
-
-  int16_t *p = pss;
-
-  for (int i = 0; i < LENGTH_PSS_NR; i++) {
-    printf(" pss ref [%d]  %d  %d at address %p\n", i, p[2*i], p[2*i+1], &p[2*i]);
-    printf(" pss ext [%d]  %d  %d at address %p\n", i, pss_ext2[2*i], pss_ext2[2*i+1], &pss_ext2[2*i]);
-  }
-
-#endif
-
-#if 0
-
-  for (int i = 0; i < LENGTH_PSS_NR; i++) {
-    printf(" sss ext 2 [%d]  %d  %d at address %p\n", i, sss_ext2[2*i], sss_ext2[2*i+1], &sss_ext2[2*i]);
-    printf(" sss ref   [%d]  %d  %d at address %p\n", i, d_sss[0][0][i], d_sss[0][0][i], &d_sss[0][0][i]);
-  }
-
-#endif
-
-  int32_t amp;
-  int shift;
-    for (i = 0; i < LENGTH_PSS_NR; i++) {
+  int16_t *pss = get_primary_synchro_nr2(ue->common_vars.nid2);
 
+  for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
+    c16_t *sss_ext2 = sss_ext[aarx];
+    c16_t *pss_ext2 = pss_ext[aarx];
+    for (int i = 0; i < LENGTH_PSS_NR; i++) {
       // This is H*(PSS) = R* \cdot PSS
-      tmp_re = pss_ext2[i*2] * pss[i];
-      tmp_im = -pss_ext2[i*2+1] * pss[i];
+      const int tmp_re = pss_ext2[i].r * pss[i];
+      const int tmp_im = -pss_ext2[i].i * pss[i];
       
-      amp = (((int32_t)tmp_re)*tmp_re) + ((int32_t)tmp_im)*tmp_im;
-      shift = log2_approx(amp)/2;
-#if 0
-      printf("H*(%d,%d) : (%d,%d)\n",aarx,i,tmp_re,tmp_im);
-      printf("pss(%d,%d) : (%d,%d)\n",aarx,i,pss[2*i],pss[2*i+1]);
-      printf("pss_ext(%d,%d) : (%d,%d)\n",aarx,i,pss_ext2[2*i],pss_ext2[2*i+1]);
-      if (aarx==0) {
-       chest[i<<1]=tmp_re;
-       chest[1+(i<<1)]=tmp_im;
-      }
-#endif      
+      const int32_t amp = tmp_re * tmp_re + tmp_im * tmp_im;
+      const int shift = log2_approx(amp) / 2;
       // This is R(SSS) \cdot H*(PSS)
-      tmp_re2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i*2])>>shift)    - ((tmp_im * (int32_t)sss_ext2[i*2+1]>>shift)));
-      tmp_im2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i*2+1])>>shift)  + ((tmp_im * (int32_t)sss_ext2[i*2]>>shift)));
-
+      const c16_t tmp = {(tmp_re * sss_ext2[i].r - tmp_im * sss_ext2[i].i) >> shift,
+                         (tmp_re * sss_ext2[i].i + tmp_im * sss_ext2[i].r) >> shift};
       // printf("SSSi(%d,%d) : (%d,%d)\n",aarx,i,sss_ext2[i<<1],sss_ext2[1+(i<<1)]);
       // printf("SSSo(%d,%d) : (%d,%d)\n",aarx,i,tmp_re2,tmp_im2);
       // MRC on RX antennas
-      if (aarx==0) {
-        sss_ext3[i<<1]      = tmp_re2;
-        sss_ext3[1+(i<<1)]  = tmp_im2;
+      if (aarx == 0) {
+        sss_ext2[i].r = tmp.r;
+        sss_ext2[i].i = tmp.i;
       } else {
-        sss_ext3[i<<1]      += tmp_re2;
-        sss_ext3[1+(i<<1)]  += tmp_im2;
+        sss_ext2[i].r += tmp.r;
+        sss_ext2[i].i += tmp.i;
       }
     }
   }
@@ -313,32 +262,29 @@ int pss_ch_est_nr(PHY_VARS_NR_UE *ue,
 *
 *********************************************************************/
 
-int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
-                          UE_nr_rxtx_proc_t *proc,
-                          int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
-                          int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
-                          uint8_t doPss, uint8_t doSss,
-                          uint8_t subframe,
-                          c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) // add flag to indicate extracting only PSS, only SSS, or both
+static int do_pss_sss_extract_nr(
+    PHY_VARS_NR_UE *ue,
+    UE_nr_rxtx_proc_t *proc,
+    c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
+    c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
+    uint8_t doPss,
+    uint8_t doSss,
+    uint8_t subframe,
+    c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) // add flag to indicate extracting only PSS, only SSS, or both
 {
-  uint8_t aarx;
-  int32_t *pss_rxF,*pss_rxF_ext;
-  int32_t *sss_rxF,*sss_rxF_ext;
-  uint8_t pss_symbol, sss_symbol;
   NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
 
-  for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
-
-    pss_symbol = 0;
-    sss_symbol = SSS_SYMBOL_NB-PSS_SYMBOL_NB;
+  for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
+    int pss_symbol = 0;
+    int sss_symbol = SSS_SYMBOL_NB - PSS_SYMBOL_NB;
 
     unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size;
 
-    pss_rxF  =  (int32_t *)&rxdataF[aarx][pss_symbol*ofdm_symbol_size];
-    sss_rxF  =  (int32_t *)&rxdataF[aarx][sss_symbol*ofdm_symbol_size];
+    c16_t *pss_rxF = rxdataF[aarx] + pss_symbol * ofdm_symbol_size;
+    c16_t *sss_rxF = rxdataF[aarx] + sss_symbol * ofdm_symbol_size;
 
-    pss_rxF_ext = &pss_ext[aarx][0];
-    sss_rxF_ext = &sss_ext[aarx][0];
+    c16_t *pss_rxF_ext = pss_ext[aarx];
+    c16_t *sss_rxF_ext = sss_ext[aarx];
 
     unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56;
 
@@ -396,12 +342,12 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
 *
 *********************************************************************/
 
-int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
-                       UE_nr_rxtx_proc_t *proc,
-                       int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
-                       int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
-                       uint8_t subframe,
-                       c16_t rxdataF[][phy_vars_ue->frame_parms.samples_per_slot_wCP])
+static int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
+                              UE_nr_rxtx_proc_t *proc,
+                              c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
+                              c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
+                              uint8_t subframe,
+                              c16_t rxdataF[][phy_vars_ue->frame_parms.samples_per_slot_wCP])
 {
   return do_pss_sss_extract_nr(phy_vars_ue, proc, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe, rxdataF);
 }
@@ -422,12 +368,11 @@ int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
 int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, uint8_t *phase_max, int *freq_offset_sss, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
 {
   uint8_t i;
-  int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
-  int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR];
-  uint8_t Nid2 = GET_NID2(ue->common_vars.eNb_id);
+  c16_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
+  c16_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR];
+  uint8_t Nid2 = GET_NID2(ue->common_vars.nid2);
   uint16_t Nid1;
   uint8_t phase;
-  int16_t *sss;
   NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
   int32_t metric, metric_re;
   int16_t *d;
@@ -473,7 +418,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
   // now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h
   *tot_metric = INT_MIN;
 
-  sss = (int16_t*)&sss_ext[0][0];
+  c16_t *sss = sss_ext[0];
 
 #ifdef DEBUG_PLOT_SSS
 
@@ -498,7 +443,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
 
         for (int i = 0; i < LENGTH_SSS_NR; i++) {
           printf("sss ref  [%i] : %d \n", i, d_sss[0][0][i]);
-          printf("sss ext  [%i] : %d %d \n", i, sss[2*i], sss[2*i+1]);
+          printf("sss ext  [%i] : %d %d \n", i, sss[i].r, sss[i].i);
 
           printf("pss ref [%i] : %d %d \n", i, primary_synchro_nr2[0][2*i], primary_synchro_nr2[0][2*i+1]);
           printf("pss ext [%i] : %d %d \n", i, ps[2*i], ps[2*i+1]);
@@ -528,12 +473,7 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
 
       // This is the inner product using one particular value of each unknown parameter
       for (i=0; i < LENGTH_SSS_NR; i++) {
-
-        metric_re += d[i]*(((phase_re_nr[phase]*sss[2*i])>>SCALING_METRIC_SSS_NR) - ((phase_im_nr[phase]*sss[2*i+1])>>SCALING_METRIC_SSS_NR));
-                   
-#if 0
-	  printf("i %d, phase %d/%d: metric %d, phase (%d,%d) sss (%d,%d) d %d\n",i,phase,PHASE_HYPOTHESIS_NUMBER,metric_re,phase_re_nr[phase],phase_im_nr[phase],sss[2*i],sss[1+(2*i)],d[i]);
-#endif
+        metric_re += d[i] * ((phase_re_nr[phase] * sss[i].r - phase_im_nr[phase] * sss[i].i) >> SCALING_METRIC_SSS_NR);
       }
 
       metric = metric_re;
@@ -574,8 +514,8 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
   }
   d = (int16_t *)&d_sss[Nid2][Nid1];
   for(i = 0; i<LENGTH_SSS_NR; i++) {
-    re += d[i]*sss[2*i];
-    im += d[i]*sss[2*i+1];
+    re += d[i] * sss[i].r;
+    im += d[i] * sss[i].i;
   }
   double ffo_sss = atan2(im,re)/M_PI/4.3;
   *freq_offset_sss = (int)(ffo_sss*frame_parms->subcarrier_spacing);
diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h
index 2d1c391e2e9ee14ee0ceb3da7442f742b6e9d674..870f093c74d3552c4eb85c89dffa2388250ec135 100644
--- a/openair1/PHY/defs_nr_UE.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -244,8 +244,8 @@ typedef struct {
   int32_t *sync_corr;
   /// estimated frequency offset (in radians) for all subcarriers
   int32_t freq_offset;
-  /// eNb_id user is synched to
-  int32_t eNb_id;
+  /// nid2 is the PSS value, the PCI (physical cell id) will be: 3*NID1 (SSS value) + NID2 (PSS value)
+  int32_t nid2;
 } NR_UE_COMMON;
 
 #define NR_PRS_IDFT_OVERSAMP_FACTOR 1  // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c
index e044d36eaeb99552a5d8fefa79fd1eac299d5eff..00546f01df4e9310f1719707413fc9af04b38bf3 100644
--- a/openair2/RRC/NR_UE/rrc_UE.c
+++ b/openair2/RRC/NR_UE/rrc_UE.c
@@ -1014,13 +1014,20 @@ int8_t nr_rrc_ue_generate_ra_msg(module_id_t module_id, uint8_t gNB_index) {
   return 0;
 }
 
-int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
-                                               const uint8_t gNB_index,
-                                               uint8_t *const Sdu,
-                                               const uint8_t Sdu_len,
-                                               const uint8_t rsrq,
-                                               const uint8_t rsrp) {
-
+/**\brief decode NR BCCH-DLSCH (SI) messages
+   \param module_idP    module id
+   \param gNB_index     gNB index
+   \param sduP          pointer to buffer of ASN message BCCH-DLSCH
+   \param sdu_len       length of buffer
+   \param rsrq          RSRQ
+   \param rsrp          RSRP*/
+static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
+                                                      const uint8_t gNB_index,
+                                                      uint8_t *const Sdu,
+                                                      const uint8_t Sdu_len,
+                                                      const uint8_t rsrq,
+                                                      const uint8_t rsrp)
+{
   NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
   NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index];
   NR_SIB1_t *sib1 = SI_info->sib1;
diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h
index 30919d88d2828b50efb5289dbf8af8b969fbe0e2..da79f9a092ce5dbf05a477e86953fbe7926ab174 100644
--- a/openair2/RRC/NR_UE/rrc_proto.h
+++ b/openair2/RRC/NR_UE/rrc_proto.h
@@ -94,20 +94,6 @@ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_beare
    \param sdu_len       length of buffer*/
 int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len);
 
-/**\brief decode NR BCCH-DLSCH (SI) messages
-   \param module_idP    module id
-   \param gNB_index     gNB index
-   \param sduP          pointer to buffer of ASN message BCCH-DLSCH
-   \param sdu_len       length of buffer
-   \param rsrq          RSRQ
-   \param rsrp          RSRP*/
-int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len, const uint8_t rsrq, const uint8_t rsrp);
-
-/**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3
-   \param module_id  module id
-   \param gNB_index  gNB index
-   \param buffer     encoded DCCH bytes stream message
-   \param size       length of buffer*/
 int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const uint8_t gNB_index, const uint8_t *buffer, const uint32_t size);
 
 /**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)