Updated Fit code