Altered the implementation of repeat.