add counter class and tests