moved most of the html code to layout.py