Worked on residuals and diagnostics