Updated to write HTML to a file instead of stdout