Somewhat more stable algorithm for stepping.