Gradient

I think this and the other gradient branches are ready to merge.