Changed the template management system to avoid the mess