fixup the Counter API, and add to declarative
Merge branch 'counter'