Adding replay function