Extract module counter into its own class.