finish counter implementation, cleanup, coding standards