final working version of rep counters