Gradient code added

Made a lot of changes