Added a repeatTask function