Least squares method added