Removes unused templates.