Refactored comment counter