Add the counting mechanism