Working towards correct gradient implementation
Made a few changes to gradients