Automating Templates