Least squares fitting added