tidy up code ready for other types of counter