drawNextIteration function cleans things up