got the gradients working