double word count implementation