Optimizing HTML Patterns