Clean up code and allow for replaying.