RE: Writing a counter function