optimize style and template.