Some quick changes to allow custom counter init. Needs refactoring.