made only one copy of counter. Added unit test