final version of expected_counter.py