Uses a safer method of removing pages

By selecting not only by page name but also by template.