Added print statements to visualize progress.