found a way to stop the simualtion trying to run forever. added in a count variable that is incremented after every step. however there are still bugs in the program with the event passing.