Now supports counting repetitions