most of the replay code done