Better representation for the gradient function