Gradient

*** Please do not merge ***

Need's more thorough testing and documentations.