Printing the step for each iteration
Cleaning up some code and adding comments