Gradient implementation done! Tested and everything :-)