Create Counter class and implement necessary methods