Added some code to write_to_html