added index fit and residuals in