Refactor some code and remove the cycling through frames at end of pipeline, as we'll want to be able to run the pipeline again