added run least squares function