use -1 to denote infinite in Repeat