Change to use a Counter class and use bind to pass callbacks.