Fixed memory leak
Adding prefit residuals and toas
Merge remote-tracking branch 'upstream/master'