Changed flow of control for running the program, so that it's all sequential, and thus replay works correctly.