diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index 3472b14efcf09695f156d57ee6cbd69cc89ff1b3..6450b642989a88e5939233c8bc3ef717165ac96b 100755
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1069,12 +1069,12 @@
       <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
       <pre_exec_args></pre_exec_args>
       <main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
-      <main_exec_args>-s0 -S1 -n1000 -R106
-                      -s0 -S1 -n10 -I -R106
-		      -s0 -S1 -n1000 -R217
-                      -s0 -S1 -n10 -I -R217
-		      -s0 -S1 -n1000 -R273
-                      -s0 -S1 -n10 -I -R273</main_exec_args>
+      <main_exec_args>-s-11 -S-8 -n10 -R106
+                      -s-11 -S-8 -n10 -o8000 -I -R106
+                      -s-11 -S-8 -n10 -R217
+                      -s-11 -S-8 -n10 -o8000 -I -R217
+                      -s-11 -S-8 -n10 -R273
+                      -s-11 -S-8 -n10 -o8000 -I -R273</main_exec_args>
       <tags>nr_pbchsim.test1 nr_pbchsim.test2 nr_pbchsim.test3 nr_pbchsim.test4 nr_pbchsim.test5 nr_pbchsim.test6</tags>
       <search_expr_true>PBCH test OK</search_expr_true>
       <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index c00804ac57eab47ee02779e6b3a31c7fdf3331f4..0a59ba3b6aebc34ceaa015987463cf3fd3c0d179 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -886,26 +886,13 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
 }
 
 int computeSamplesShift(PHY_VARS_NR_UE *UE) {
-
-  // compute TO compensation that should be applied for this frame
-  if ( UE->rx_offset < UE->frame_parms.samples_per_frame/2  &&
-       UE->rx_offset > 0 ) {
-    LOG_I(PHY,"!!!adjusting -1 samples!!! rx_offset == %d\n", UE->rx_offset);
-    UE->rx_offset   = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
-    UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
-    return -1 ;
-  }
-
-  if ( UE->rx_offset > UE->frame_parms.samples_per_frame/2 &&
-       UE->rx_offset < UE->frame_parms.samples_per_frame ) {
-    int rx_offset = UE->rx_offset - UE->frame_parms.samples_per_frame;
-    LOG_I(PHY,"!!!adjusting +1 samples!!! rx_offset == %d\n", rx_offset);
-    UE->rx_offset   = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
-    UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
-    return 1;
+  int samples_shift = -(UE->rx_offset>>1);
+  UE->rx_offset   = 0; // reset so that it is not applied falsely in case of SSB being only in every second frame
+  UE->max_pos_fil = 0; // reset IIR filter when sample shift is applied
+  if (samples_shift != 0) {
+    LOG_I(NR_PHY,"Adjusting frame in time by %i samples\n", samples_shift);
   }
-
-  return 0;
+  return samples_shift;
 }
 
 static inline int get_firstSymSamp(uint16_t slot, NR_DL_FRAME_PARMS *fp) {
diff --git a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
index 52a9c41ae95c8b113ffa58677f1f7810bbc323b9..44f8549258cf11ff7a4a8ef3310653f92697d609 100644
--- a/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
+++ b/openair1/PHY/NR_REFSIG/ss_pbch_nr.h
@@ -65,6 +65,7 @@
 /* SS/PBCH parameters */
 #define  N_RB_SS_PBCH_BLOCK           (20)
 #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  N_SYMB_SLOT                  (14)
diff --git a/openair1/PHY/NR_REFSIG/sss_nr.h b/openair1/PHY/NR_REFSIG/sss_nr.h
index 12d91ed3d1cd88ab030ae1d9fea88e59dd712862..03610ae30fb5adc597906d7f39e8ab8a27ad4b3c 100644
--- a/openair1/PHY/NR_REFSIG/sss_nr.h
+++ b/openair1/PHY/NR_REFSIG/sss_nr.h
@@ -63,18 +63,22 @@
 
 /************** VARIABLES *****************************************/
 
-#define PHASE_HYPOTHESIS_NUMBER       (7)
+#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
-= {16383, 25101, 30791, 32767, 30791, 25101, 16383}
+// -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
-= {-28378, -21063, -11208, 0, 11207, 21062, 28377};
+// -pi/3 ---- pi/3
+= {-28377,-25821,-22762,-19260,-15383,-11207,-6813,-2286,2286,6813,11207,
+   15383,19260,22762,25821,28377}
 #endif
 ;
 
@@ -92,7 +96,7 @@ 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 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);
 
 #undef INIT_VARIABLES_SSS_NR_H
 #undef EXTERN
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
index 19d4bf5079e08073040a4c71c2619d90fa6920fe..15f3abad795b143de81a9a01888e2e3d6a2a0ee7 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
@@ -115,12 +115,6 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
     }
   }
 
-  if (ue->rx_offset < 0)
-    ue->rx_offset += frame_parms->samples_per_frame;
-
-  if (ue->rx_offset >= frame_parms->samples_per_frame)
-    ue->rx_offset -= frame_parms->samples_per_frame;
-
 #ifdef DEBUG_PHY
   LOG_D(PHY,"AbsSubframe %d: diff = %i, rx_offset (final) = %i : clear = %d, max_pos = %d, max_pos_fil = %d, max_val = %d, sync_pos %d\n",
         subframe,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
index 8917a8bc1b1ebc4ca0a6db92073c18be024e044c..c79d873127226fee91b600021c33fa429bcb2bbb 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
@@ -31,8 +31,6 @@
 */
 #include "PHY/types.h"
 #include "PHY/defs_nr_UE.h"
-#include "PHY/phy_extern_nr_ue.h"
-#include "PHY/INIT/phy_init.h"
 #include "PHY/MODULATION/modulation_UE.h"
 #include "nr_transport_proto_ue.h"
 #include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
@@ -46,7 +44,6 @@
 #include "PHY/NR_REFSIG/pss_nr.h"
 #include "PHY/NR_REFSIG/sss_nr.h"
 #include "PHY/NR_REFSIG/refsig_defs_ue.h"
-#include "PHY/NR_TRANSPORT/nr_dci.h"
 
 extern openair0_config_t openair0_cfg[];
 //static  nfapi_nr_config_request_t config_t;
@@ -200,6 +197,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
 {
 
   int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
+  int32_t accumulated_freq_offset = 0;
   int32_t metric_tdd_ncp=0;
   uint8_t phase_tdd_ncp;
   double im, re;
@@ -248,22 +246,30 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
     LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset);
 #endif
 
+     accumulated_freq_offset += ue->common_vars.freq_offset;
+
     // digital compensation of FFO for SSB symbols
-    if (ue->UE_fo_compensation){  
-	double s_time = 1/(1.0e3*fp->samples_per_subframe);  // sampling time
-	double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset);  // offset rotation angle compensation per sample
-
-	int start = is*fp->samples_per_frame+ue->ssb_offset;  // start for offset correction is at ssb_offset (pss time position)
-  	int end = start + 4*(fp->ofdm_symbol_size + fp->nb_prefix_samples);  // loop over samples in 4 symbols (ssb size), including prefix  
-
-	for(int n=start; n<end; n++){  	
-	  for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
-		re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
-		im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
-		((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle))); 
-		((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
-	  }
-	}
+    if (ue->UE_fo_compensation){
+      double s_time = 1/(1.0e3*fp->samples_per_subframe);  // sampling time
+      double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset);  // offset rotation angle compensation per sample
+
+      // In SA we need to perform frequency offset correction until the end of buffer because we need to decode SIB1
+      // and we do not know yet in which slot it goes.
+
+      // start for offset correction
+      int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset;
+
+      // loop over samples
+      int end = sa ? n_frames*fp->samples_per_frame-1 : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
+
+      for(int n=start; n<end; n++){
+        for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
+          re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
+          im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
+          ((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
+          ((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
+        }
+      }
     }
 
     /* check that SSS/PBCH block is continuous inside the received buffer */
@@ -289,7 +295,34 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
       LOG_I(PHY,"Calling sss detection (normal CP)\n");
 #endif
 
-      rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp);
+      int freq_offset_sss = 0;
+      rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss);
+
+      accumulated_freq_offset += freq_offset_sss;
+
+      // digital compensation of FFO for SSB symbols
+      if (ue->UE_fo_compensation){
+        double s_time = 1/(1.0e3*fp->samples_per_subframe);  // sampling time
+        double off_angle = -2*M_PI*s_time*freq_offset_sss;   // offset rotation angle compensation per sample
+
+        // In SA we need to perform frequency offset correction until the end of buffer because we need to decode SIB1
+        // and we do not know yet in which slot it goes.
+
+        // start for offset correction
+        int start = sa ? is*fp->samples_per_frame : is*fp->samples_per_frame + ue->ssb_offset;
+
+        // loop over samples
+        int end = sa ? n_frames*fp->samples_per_frame-1 : start + NR_N_SYMBOLS_SSB*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
+
+        for(int n=start; n<end; n++){
+          for (int ar=0; ar<fp->nb_antennas_rx; ar++) {
+            re = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n]);
+            im = ((double)(((short *)ue->common_vars.rxdata[ar]))[2*n+1]);
+            ((short *)ue->common_vars.rxdata[ar])[2*n] = (short)(round(re*cos(n*off_angle) - im*sin(n*off_angle)));
+            ((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle)));
+          }
+        }
+      }
 
       nr_gold_pbch(ue);
       ret = nr_pbch_detection(proc, ue, 1);  // start pbch detection at first symbol after pss
@@ -536,6 +569,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
     }
     if (dec == false) // sib1 not decoded
       ret = -1;
+
+    ue->common_vars.freq_offset = accumulated_freq_offset;
   }
   //  exit_fun("debug exit");
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
index 28b6677b2ca9f0a5e7c77e9841b0246242ba6115..4fc11d5fc6ca44910178a64432a68ee799012f54 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
@@ -34,6 +34,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <math.h>
+#include <nr-uesoftmodem.h>
 
 #include "PHY/defs_nr_UE.h"
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
index 9339f3974d4cdb31cb01c12ad35e655cc3aebd89..dc73fe0add1226bfaeff3d433ee7d613d9d601ce 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
@@ -420,7 +420,7 @@ 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 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)
 {
   uint8_t i;
   int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR];
@@ -558,5 +558,19 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
   }
   //#endif
 
+  int re = 0;
+  int im = 0;
+  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];
+  }
+  double ffo_sss = atan2(im,re)/M_PI/4.3;
+  *freq_offset_sss = (int)(ffo_sss*frame_parms->subcarrier_spacing);
+
+  double ffo_pss = ((double)ue->common_vars.freq_offset)/frame_parms->subcarrier_spacing;
+  LOG_I(NR_PHY, "ffo_pss %f (%i Hz), ffo_sss %f (%i Hz),  ffo_pss+ffo_sss %f (%i Hz)\n",
+         ffo_pss, (int)(ffo_pss*frame_parms->subcarrier_spacing), ffo_sss, *freq_offset_sss, ffo_pss+ffo_sss, (int)((ffo_pss+ffo_sss)*frame_parms->subcarrier_spacing));
+
   return(0);
 }
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index c6b547cd79b4346dac610adfbde956497c5aa069..0f5752c2277250c68369162854bc8b8d3cda4214 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -202,15 +202,15 @@ int main(int argc, char **argv)
 
   float target_error_rate = 0.01;
 
+  int seed = 0;
+
   cpuf = get_cpu_freq_GHz();
 
   if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
     exit_fun("[NR_PBCHSIM] Error, configuration module init failed\n");
   }
 
-  randominit(0);
-
-  while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:o:s:S:t:x:y:z:M:N:F:GR:dP:IL:m:")) != -1) {
+  while ((c = getopt (argc, argv, "F:g:hIL:m:M:n:N:o:P:r:R:s:S:x:y:z:")) != -1) {
     switch (c) {
     /*case 'f':
       write_output_file=1;
@@ -227,6 +227,14 @@ int main(int argc, char **argv)
       frame_type = 1;
       break;*/
 
+    case 'F':
+      input_fd = fopen(optarg,"r");
+      if (input_fd==NULL) {
+        printf("Problem with filename %s. Exiting.\n", optarg);
+        exit(-1);
+      }
+      break;
+
     case 'g':
       switch((char)*optarg) {
       case 'A':
@@ -264,18 +272,42 @@ int main(int argc, char **argv)
 
       break;
 
-    /*case 'i':
+    /*
+    case 'i':
       interf1=atoi(optarg);
       break;
+    */
 
+    case 'I':
+      run_initial_sync=1;
+      target_error_rate=0.1;
+      break;
+
+    /*
     case 'j':
       interf2=atoi(optarg);
       break;*/
 
+    case 'L':
+      loglvl = atoi(optarg);
+      break;
+
+    case 'm':
+      mu = atoi(optarg);
+      break;
+
+    case 'M':
+      SSB_positions = atoi(optarg);
+      break;
+
     case 'n':
       n_trials = atoi(optarg);
       break;
 
+    case 'N':
+      Nid_cell = atoi(optarg);
+      break;
+
     case 'o':
       cfo = atof(optarg);
 #ifdef DEBUG_NR_PBCHSIM
@@ -283,6 +315,34 @@ int main(int argc, char **argv)
 #endif
       break;
 
+    /*case 'p':
+      extended_prefix_flag=1;
+      break;*/
+
+    case 'P':
+      pbch_phase = atoi(optarg);
+      if (pbch_phase>3)
+        printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
+      break;
+
+    /*
+    case 'r':
+      ricean_factor = pow(10,-.1*atof(optarg));
+      if (ricean_factor>1) {
+        printf("Ricean factor must be between 0 and 1\n");
+        exit(-1);
+      }
+      break;
+    */
+
+    case 'r':
+      seed = atoi(optarg);
+      break;
+
+    case 'R':
+      N_RB_DL = atoi(optarg);
+      break;
+
     case 's':
       snr0 = atof(optarg);
 #ifdef DEBUG_NR_PBCHSIM
@@ -303,19 +363,7 @@ int main(int argc, char **argv)
       Td= atof(optarg);
       break;
       */
-    /*case 'p':
-      extended_prefix_flag=1;
-      break;*/
 
-      /*
-      case 'r':
-      ricean_factor = pow(10,-.1*atof(optarg));
-      if (ricean_factor>1) {
-        printf("Ricean factor must be between 0 and 1\n");
-        exit(-1);
-      }
-      break;
-      */
     case 'x':
       transmission_mode=atoi(optarg);
 
@@ -328,99 +376,58 @@ int main(int argc, char **argv)
 
     case 'y':
       n_tx=atoi(optarg);
-
       if ((n_tx==0) || (n_tx>2)) {
-    	printf("Unsupported number of TX antennas %d. Exiting.\n", n_tx);
+        printf("Unsupported number of TX antennas %d. Exiting.\n", n_tx);
         exit(-1);
       }
-
       break;
 
     case 'z':
       n_rx=atoi(optarg);
-
       if ((n_rx==0) || (n_rx>2)) {
-    	printf("Unsupported number of RX antennas %d. Exiting.\n", n_rx);
+        printf("Unsupported number of RX antennas %d. Exiting.\n", n_rx);
         exit(-1);
       }
-
-      break;
-
-    case 'M':
-      SSB_positions = atoi(optarg);
-      break;
-
-    case 'N':
-      Nid_cell = atoi(optarg);
-      break;
-
-    case 'R':
-      N_RB_DL = atoi(optarg);
-      break;
-
-    case 'F':
-      input_fd = fopen(optarg,"r");
-
-      if (input_fd==NULL) {
-        printf("Problem with filename %s. Exiting.\n", optarg);
-        exit(-1);
-      }
-
-      break;
-
-    case 'P':
-      pbch_phase = atoi(optarg);
-
-      if (pbch_phase>3)
-        printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
-
-      break;
-      
-    case 'I':
-      run_initial_sync=1;
-      target_error_rate=0.1;
-      break;
-
-    case 'L':
-      loglvl = atoi(optarg);
-      break;
-
-    case 'm':
-      mu = atoi(optarg);
       break;
 
     default:
     case 'h':
-      printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
+      printf("%s -F input_filename -g channel_mod -h(elp) -I(nitial sync) -L log_lvl -n n_frames -M SSBs -n frames -N cell_id -o FO -P phase -r seed -R RBs -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant\n",
              argv[0]);
-      printf("-h This message\n");
-      //printf("-p Use extended prefix mode\n");
+      //printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
+      //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
       //printf("-d Use TDD\n");
-      printf("-n Number of frames to simulate\n");
-      printf("-m Numerology index\n");
-      printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB.  If n_frames is 1 then just SNR is simulated\n");
-      printf("-S Ending SNR, runs from SNR0 to SNR1\n");
-      printf("-t Delay spread for multipath channel\n");
+      //printf("-f Output filename (.txt format) for Pe/SNR results\n");
+      printf("-F Input filename (.txt format) for RX conformance testing\n");
       printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
-      printf("-x Transmission mode (1,2,6 for the moment)\n");
-      printf("-y Number of TX antennas used in eNB\n");
-      printf("-z Number of RX antennas used in UE\n");
+      printf("-h This message\n");
       //printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
+      printf("-I run initial sync with target error rate 0.1\n");
       //printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
-      printf("-o Carrier frequency offset in Hz\n");
+      printf("-L set the log level (-1 disable, 0 error, 1 warning, 2 info, 3 debug, 4 trace)\n");
+      printf("-m Numerology index\n");
       printf("-M Multiple SSB positions in burst\n");
+      printf("-n Number of frames to simulate\n");
       printf("-N Nid_cell\n");
+      printf("-o Carrier frequency offset in Hz\n");
+      //printf("-O oversampling factor (1,2,4,8,16)\n");
+      //printf("-p Use extended prefix mode\n");
+      printf("-P PBCH phase, allowed values 0-3\n");
+      printf("-r set the random number generator seed (default: 0 = current time)\n");
       printf("-R N_RB_DL\n");
-      printf("-O oversampling factor (1,2,4,8,16)\n");
-      printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
-      //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
-      //printf("-f Output filename (.txt format) for Pe/SNR results\n");
-      printf("-F Input filename (.txt format) for RX conformance testing\n");
+      printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if not -S given. If -n 1, then just SNR is simulated\n");
+      printf("-S Ending SNR, runs from SNR0 to SNR1\n");
+      //printf("-t Delay spread for multipath channel\n");
+      printf("-x Transmission mode (1,2,6 for the moment)\n");
+      printf("-y Number of TX antennas used in eNB\n");
+      printf("-z Number of RX antennas used in UE\n");
       exit (-1);
       break;
     }
   }
 
+  randominit(seed);
+
   logInit();
   set_glog(loglvl);
   T_stdout = 1;
@@ -654,13 +661,6 @@ int main(int argc, char **argv)
 		  	  	  	  	    frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
   printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/
 
-
-  for (i=0; i<frame_length_complex_samples; i++) {
-    for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
-      r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
-      r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
-    }
-  }
   
   for (SNR=snr0; SNR<snr1; SNR+=.2) {
 
@@ -668,6 +668,14 @@ int main(int argc, char **argv)
     n_errors_payload = 0;
 
     for (trial=0; trial<n_trials; trial++) {
+
+      for (i=0; i<frame_length_complex_samples; i++) {
+        for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
+          r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
+          r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
+        }
+      }
+
       // multipath channel
       //multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
       
@@ -696,13 +704,11 @@ int main(int argc, char **argv)
            0.0,  // IQ imbalance (dB),
 	   0.0); // IQ phase imbalance (rad)
 
-   
       for (i=0; i<frame_length_complex_samples; i++) {
-	for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-	  
-	  ((short*) UE->common_vars.rxdata[aa])[2*i]   = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
-	  ((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
-	}
+        for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
+          ((short*) UE->common_vars.rxdata[aa])[2*i]   = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+          ((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+        }
       }
 
       if (n_trials==1) {
diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf
index b77ad0b264297e0bcf95b63bbf6e4ed3dcdd9553..2777035fddb45380d3f948c913108419d7522ab3 100644
--- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf
@@ -54,7 +54,7 @@ gNBs =
 
 #  downlinkConfigCommon
     #frequencyInfoDL
-      # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
+      # this is 2574.270 MHz + 53 PRBs@30kHz SCS (same as initial BWP)
       absoluteFrequencySSB                                             = 518670;
       dl_frequencyBand                                                 = 41;
       # this is 3600 MHz
@@ -67,7 +67,7 @@ gNBs =
         dl_carrierBandwidth                                            = 106;
      #initialDownlinkBWP
       #genericParameters
-        # this is RBstart=27,L=48 (275*(L-1))+RBstart
+        # this is RBstart=0,L=106 (275*(L-1))+RBstart
         initialDLBWPlocationAndBandwidth                               = 28875; # 6366 12925 12956 28875 12952
 # subcarrierSpacing
 # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120