Add proper templating to #520