Adding gradients and minor fixes

Feat @Larry006
That would be awesome