Implemented counter code (no UI change)