Reducing code sharing between gradients by introducing Gradient (supertype)