refactored way of counting: use google collections object instead of my own counter