Refactor HTML code