Added gradient calculation (and visualisation)