polishing the template