least squares optimization was added