working -the replay function