Added snr calculation to fit_phase_shift; minor other changes.