moderate update: calculate_step_length now has a catch for maxima in the polynomial fit and negative step lengths