Refactor make_html