Replaced applySteps with a scanl