repeat function now works