added offsets to Derivative function