working on residuals() structure