Simplify CountMap signature. Add tests.