Added feature to delete templates on deactivate