Refactor HTML5Writer