Created new module mainhtml.py and moved HTML generation code to the new module.