Added gradient descent method.