Add new count method and refactor.