Cleanup and Total-Least-Squares solver