Added 'template' table, and related tables