Added counter functionality