Moved all duplicate layout code to layout.html