fixed login
began using templating, and extracted common code out to layout.html