[#1183] Clean up template code