Completely restructures the templates

This commit cleans up the templates by introducing "layouts" to the
templating.