simplify some code in replay_controller