adding gradient descent algorithm