HTML from template

Revised the HTML generation code; it now reads from the
index_template.html file, and injects code to the locations marked by
the comments we discussed.