improved generic stepper implementation - now uses range algebra. however, code is still a bit ugly...