fixed grad and hess functions, reverted back to vectors instead of x,y