Move counter state machine to separate service.