Corrected translate() and added residuals