upgraded version of counter