Pull Request 2 Dev 1.1

this block seem to be repeated in count() method L69 ~ L75, I think it's better if you can place this part inside another method to avoid duplicate code