simplified reducer implementation