changed logic to account for rest step.