Refactor, output steps in a loop