Updating iteration.py to clean up the main function