Make the example use the DynamicCounter utility class.

Currently the example is not using an existing class. Make it work with DynamicCounter