Changed how the process looping works to be simpler.