added nonNegativeDerivative function