implements counter