Change some awkward formatting code to use mustache.