counter reducer implementation