Added counter code.