Adding gradients and minor fixes

Feat @Larry006
Good point