Added repeatXTimes function