add callbacks and pass the counters