Modularise counter template, closes item:634