function final = fitSimulFunNew(threeSpin,user)

exp_build_up_H1H2_norm                          = threeSpin.buildups.exp_build_up_H1H2_norm;
sigmaEff_scaling                                = threeSpin.numcode.sigmaEffScaling; % According to what was added together.
corrD2O_factor                                  = threeSpin.numcode.corrD2O_factor;
mixtimes                                        = threeSpin.buildups.mixTimes;
exp_sigma                                       = threeSpin.buildups.sigmaij;
exp_rho_H1                                     	= threeSpin.buildups.rhoi;
exp_rho_H2                                     	= threeSpin.buildups.rhoj; 

% % simul                                           = threeSpin.sumSelBuildups;
simul                                           = threeSpin.simul{1};

for j=1:size(simul)

    sigma_H1H2                                 	= simul.sigma_H1H2(j);
    two_spins_build_up_H1H2                     = simul.two_spins_build_up_H1H2(j,:);
    two_spins_build_up_H1H2_scaled              = simul.two_spins_build_up_H1H2_scaled_sum(j,:);
    three_spins_build_up_H1H2_scaled            = simul.three_spins_build_up_H1H2_scaled_sum(j,:);

    exp_build_up_corrections                 	= two_spins_build_up_H1H2 ./ ( three_spins_build_up_H1H2_scaled - two_spins_build_up_H1H2_scaled + two_spins_build_up_H1H2 );
    exp_build_up_corrected                   	= exp_build_up_H1H2_norm .* exp_build_up_corrections;

    options = optimset('display', 'off');

% % %     start                                    	= sigma_H1H2;
    start                                    	= -0.5; 

    [exp_sigma_spinDiff_corrected, sse_target_fun_sigma, exitflag_sigma] = fminsearch(@(x)fitsigma(x, exp_rho_H1, exp_rho_H2, mixtimes ,exp_build_up_corrected, sigmaEff_scaling), start, options);
       
    exp_sigma_spinDiff_corrected              	= abs(exp_sigma_spinDiff_corrected) * (-1);

    corrFactor                                	= abs(exp_sigma_spinDiff_corrected / exp_sigma);
    
    final.exp_build_up_corrections(j,:)      	= exp_build_up_corrections;
    final.exp_build_up_corrected(j,:)          	= exp_build_up_corrected;
    final.exp_rho_H1                            = exp_rho_H1;
    final.exp_rho_H2                            = exp_rho_H2;
    final.exp_sigma                             = exp_sigma;
    final.exp_sigma_spinDiff_corrected(j)     	= exp_sigma_spinDiff_corrected;
    final.corrFactor(j)                      	= corrFactor;

end

final.partnerCount                              = simul.partnerCount;
final.sigma_H1H2                                = simul.sigma_H1H2;
  