developing least squares