added new version of repeat that takes an optional arg for n times