Better replay function