improved the way of instantiating counters