Added constructor for gradient.