Whether we look at the start or end of the data set depends on whether the delta is positive or negative. Here this only works for one case... I think.