split fitting into a .h file in preparation for chi2 minimization