diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm
index 062d39e0e58943c931b43a03d9b182e8913377fa..24075d79f2e75c782a2f6bf47493b9fbed4068df 100644
--- a/lib/AccountManager/App.pm
+++ b/lib/AccountManager/App.pm
@@ -70,9 +70,8 @@ sub new {
             "No mailer defined in configuration, aborting"
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ 'internal' ]
             }
         );
@@ -83,9 +82,8 @@ sub new {
             "No IDP defined in configuration, aborting"
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ 'internal' ]
             }
         );
@@ -96,9 +94,8 @@ sub new {
             "No database defined in configuration, aborting"
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors => [ 'internal' ]
             }
         );
@@ -156,9 +153,8 @@ sub run {
         ## unknown action
         $self->{logger}->error( "Unknown action '$action'");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "Unknown action '$action'" ]
             }
         );
@@ -185,7 +181,7 @@ sub respond {
         INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/web"
     });
 
-    $self->{logger}->debug("Responding with outer template '$in{template}' and inner template '$in{data}->{content}'");
+    $self->{logger}->debug("Responding with outer template '$in{template}'");
 
     binmode(STDOUT, ":utf8");
 
@@ -215,22 +211,20 @@ sub req_select_sp {
     if ($EVAL_ERROR) {
         $self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "internal" ]
             }
         );
     }
 
     $self->respond(
-        template => 'index.tt2.html',
+        template => 'select_sp.tt2.html',
         data     => {
             env => {
                 SCRIPT_NAME => $ENV{SCRIPT_NAME}
             },
             metadata => $metadata->parse(type => 'sp'),
-            content  => 'select_sp.tt2.html'
         }
     );
 }
@@ -241,9 +235,8 @@ sub req_select_email {
     if (! $self->{in}->{entityid}) {
         $self->{logger}->error("Missing parameter: entityid");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_entityid" ]
             }
         );
@@ -252,9 +245,8 @@ sub req_select_email {
     if ($self->{in}->{entityid} !~ $entity_id_pattern) {
         $self->{logger}->error("Incorrect parameter format: entityid");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "format_entityid" ]
             }
         );
@@ -280,9 +272,8 @@ sub req_select_email {
         if ($EVAL_ERROR) {
             $self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR");
             $self->respond(
-                template => 'index.tt2.html',
+                template => 'errors.tt2.html',
                 data     => {
-                    content => 'errors.tt2.html',
                     errors  => [ "internal" ]
                 }
             );
@@ -294,9 +285,8 @@ sub req_select_email {
                 "No such SP '%s' in metadata", $self->{in}->{entityid}
             );
             $self->respond(
-                template => 'index.tt2.html',
+                template => 'errors.tt2.html',
                 data     => {
-                    content => 'errors.tt2.html',
                     errors  => [ "no_such_entity" ]
                 }
             );
@@ -312,9 +302,8 @@ sub req_select_email {
         unless ($sp->save()) {
             $self->{logger}->error("Failed to save service provider object");
             $self->respond(
-                template => 'index.tt2.html',
+                template => 'errors.tt2.html',
                 data     => {
-                    content => 'errors.tt2.html',
                     errors  => [ "internal" ]
                 }
             );
@@ -337,10 +326,9 @@ sub req_select_email {
     }
 
     $self->respond(
-        template => 'index.tt2.html',
+        template => 'select_email.tt2.html',
         data     => {
-            sp      => $sp,
-            content => 'select_email.tt2.html'
+            sp => $sp,
         }
     );
 }
@@ -351,7 +339,7 @@ sub req_complete_challenge {
     unless ($self->{in}->{entityid}) {
         $self->{logger}->error("Missing parameter entityid");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
                 errors => [ "missing_entityid" ]
             }
@@ -361,9 +349,8 @@ sub req_complete_challenge {
     unless ($self->{in}->{email}) {
         $self->{logger}->error("Missing parameter email");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_email" ]
             }
         );
@@ -377,9 +364,8 @@ sub req_complete_challenge {
     unless ($provider->load(speculative => 1)) {
         $self->{logger}->errorf("No such SP '%s' in database", $self->{in}->{entityid});
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "no_such_entity" ]
             }
         );
@@ -409,9 +395,8 @@ sub req_complete_challenge {
             $self->{in}->{email}
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "internal" ]
             }
         );
@@ -431,9 +416,8 @@ sub req_complete_challenge {
                 $old_token->id()
             );
             $self->respond(
-                template => 'index.tt2.html',
+                template => 'errors.tt2.html',
                 data     => {
-                    content => 'errors.tt2.html',
                     errors  => [ "internal" ]
                 }
             );
@@ -455,9 +439,8 @@ sub req_complete_challenge {
     unless ($token->save()) {
         $self->{logger}->error("Failed to save authentication token");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "internal" ]
             }
         );
@@ -471,9 +454,8 @@ sub req_complete_challenge {
     open(my $handle, '|-', "$sendmail -f $sender $recipient") or do {
         $self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO);
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "mail_notification_error" ]
             }
         );
@@ -504,9 +486,8 @@ sub req_complete_challenge {
     unless ($tt2->process($template, $data, $handle)) {
         $self->{logger}->errorf("Mail notification error: %s", $tt2->error());
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "mail_notification_failure" ]
             }
         );
@@ -522,11 +503,10 @@ sub req_complete_challenge {
     );
 
     $self->respond(
-        template => 'index.tt2.html',
+        template  => 'complete_challenge.tt2.html',
         data     => {
             email    => $self->{in}->{email},
             entityid => $self->{in}->{entityid},
-            content  => 'complete_challenge.tt2.html'
         }
     );
 }
@@ -537,9 +517,8 @@ sub req_create_accounts {
     unless ($self->{in}->{entityid}) {
         $self->{logger}->error("Missing parameter entityid");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_entityid" ]
             }
         );
@@ -548,9 +527,8 @@ sub req_create_accounts {
     unless ($self->{in}->{token}) {
         $self->{logger}->error("Missing parameter token");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_token" ]
             }
         );
@@ -559,9 +537,8 @@ sub req_create_accounts {
     unless ($self->{in}->{email}) {
         $self->{logger}->error("Missing parameter email");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_email" ]
             }
         );
@@ -579,9 +556,8 @@ sub req_create_accounts {
             $self->{in}->{entityid}
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "wrong_token" ]
             }
         );
@@ -594,9 +570,8 @@ sub req_create_accounts {
             $self->{in}->{entityid}
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "wrong_token_for_sp" ]
             }
         );
@@ -634,9 +609,8 @@ sub req_create_accounts {
     unless ($download_token->save()) {
         $self->{logger}->error("Failed to save authentication token");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "internal" ]
             }
         );
@@ -668,9 +642,8 @@ sub req_create_accounts {
             $self->{in}->{entityid}
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "accounts_creation_failure" ]
             }
         );
@@ -694,9 +667,8 @@ sub req_create_accounts {
             $EVAL_ERROR
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "accounts_creation_failed" ]
             }
         );
@@ -709,13 +681,12 @@ sub req_create_accounts {
     );
 
     $self->respond(
-        template => 'index.tt2.html',
+        template => 'create_accounts.tt2.html',
         data     => {
             accounts => \@accounts,
             entityid => $self->{in}->{entityid},
             key      => $key,
             token    => $download_token->token(),
-            content  => 'create_accounts.tt2.html'
         }
     );
 }
@@ -726,9 +697,8 @@ sub req_download_accounts {
     unless ($self->{in}->{entityid}) {
         $self->{logger}->error("Missing parameter entityid");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_entityid" ]
             }
         );
@@ -737,9 +707,8 @@ sub req_download_accounts {
     unless ($self->{in}->{token}) {
         $self->{logger}->error("Missing parameter token");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_token" ]
             }
         );
@@ -748,9 +717,8 @@ sub req_download_accounts {
     unless ($self->{in}->{key}) {
         $self->{logger}->error("Missing parameter key");
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "missing_key" ]
             }
         );
@@ -767,9 +735,8 @@ sub req_download_accounts {
             $self->{in}->{token},
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "wrong_token" ]
             }
         );
@@ -782,9 +749,8 @@ sub req_download_accounts {
             $self->{in}->{entityid}
         );
         $self->respond(
-            template => 'index.tt2.html',
+            template => 'errors.tt2.html',
             data     => {
-                content => 'errors.tt2.html',
                 errors  => [ "wrong_token_for_sp" ]
             }
         );
@@ -857,10 +823,7 @@ sub req_home {
     my ($self) = @_;
 
     $self->respond(
-        template => 'index.tt2.html',
-        data     => {
-            content => 'home.tt2.html'
-        }
+        template => 'home.tt2.html',
     );
 }
 
diff --git a/templates/web/complete_challenge.tt2.html b/templates/web/complete_challenge.tt2.html
index 7f1bb3451abb4e1eb798c62078a26b6490f14196..a8483392c103d3f3a60828f760854113cbdae490 100644
--- a/templates/web/complete_challenge.tt2.html
+++ b/templates/web/complete_challenge.tt2.html
@@ -1,3 +1,4 @@
+[% WRAPPER index.tt2.html %]
 <div class="wizard clearfix vertical">
     <div class="steps clearfix">
         <ol>
@@ -23,3 +24,4 @@
         </form>
     </div>
 </div>
+[% END %]
diff --git a/templates/web/create_accounts.tt2.html b/templates/web/create_accounts.tt2.html
index 9166655d0e47128af9f6bc5bd520b3445d4f9ec1..4a5c6e56eb8fe5b31fa03d35d8d89f55287b1d38 100644
--- a/templates/web/create_accounts.tt2.html
+++ b/templates/web/create_accounts.tt2.html
@@ -1,3 +1,4 @@
+[% WRAPPER index.tt2.html %]
 <div class="grid-x align-center">
     <div class="cell shrink">
         <div class="callout success">
@@ -91,3 +92,4 @@
         <strong>[% lh.maketext("Thank you for using the eduGAIN Access Check") %]</strong>
     </div>
 </div>
+[% END %]
diff --git a/templates/web/errors.tt2.html b/templates/web/errors.tt2.html
index 59dfc88fb40cc5c9b171a3057529b72d45e917ac..840581f624d63363b73e668e8ad5a42ff87c5a12 100644
--- a/templates/web/errors.tt2.html
+++ b/templates/web/errors.tt2.html
@@ -1,3 +1,4 @@
+[% WRAPPER index.tt2.html %]
 <div class="ui-widget">
     [% FOREACH err IN errors %]
 
@@ -36,3 +37,4 @@
 
     [% lh.maketext("You can report the issue to the administrators") %] (<a href="mailto:[% app.support_email %]">[% app.support_email %]</a>).
 </div>
+[% END %]
diff --git a/templates/web/home.tt2.html b/templates/web/home.tt2.html
index d8a1ae131822f7a5b18af3aa8cb7791acff109ed..c4376cb23a487032616edb4318b2b2676176633e 100644
--- a/templates/web/home.tt2.html
+++ b/templates/web/home.tt2.html
@@ -1,3 +1,5 @@
+[% WRAPPER index.tt2.html %]
+
 <h2>[% lh.maketext("Objective") %]</h2>
 <p>
 [%
@@ -17,3 +19,4 @@
 <p>[% lh.maketext("To start testing your own services, start by selecting one your are administrator for.") %]</p>
 <p class="text-center"><a href="[% app.url %]?action=select_sp" class="button">[% lh.maketext("Get started") %]</a></p>
 
+[% END %]
diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html
index ef7a88a6519e281cc2fd846ccc6617f5f72bf86a..c213af56858fa5ee78937669704cb5f7c187eaad 100644
--- a/templates/web/index.tt2.html
+++ b/templates/web/index.tt2.html
@@ -29,7 +29,7 @@
         </header>
 
         <main class="row">
-            [% INCLUDE $content %]
+            [% content %]
         </main>
 
         <footer>
diff --git a/templates/web/select_email.tt2.html b/templates/web/select_email.tt2.html
index fb7cb51f8577328290eb0eff91e01249fe578f7f..fdbd456d75d2e656f4587f6724bda2d13bec1381 100644
--- a/templates/web/select_email.tt2.html
+++ b/templates/web/select_email.tt2.html
@@ -1,3 +1,4 @@
+[% WRAPPER index.tt2.html %]
 <div class="wizard clearfix">
     <div class="steps clearfix">
         <ol>
@@ -11,20 +12,20 @@
         <h2>[% lh.maketext("Select your email address") %]</h2>
         <p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", sp.displayname) %]</p>
 
-[% IF sp.contacts.defined %]
+    [% IF sp.contacts.defined %]
         <form action="[% env.SCRIPT_NAME %]" method="get">
             <p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p>
-    [% FOREACH email IN sp.contacts.sort %]
+        [% FOREACH email IN sp.contacts.sort %]
             <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/>
             <label for="[% email %]">[% email %]</label>
             <br/>
-    [% END %]
+        [% END %]
             <p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p>
             <input type="hidden" name="entityid" value="[% sp.entityid %]"/>
             <button class="button" type="submit" name="action" value="select_sp">[% lh.maketext("Previous") %]</button>
             <button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button>
         </form>
-[% ELSE %]
+    [% ELSE %]
         <p>
         [% lh.maketext("No ContactPerson element could be found in your service metadata, therefore we are unable to provide test accounts for this service.") %]
         [% lh.maketext("Please contact your federation administrators to add needed information to the metadata.") %]
@@ -32,3 +33,4 @@
 [% END %]
     </div>
 </div>
+[% END %]
diff --git a/templates/web/select_sp.tt2.html b/templates/web/select_sp.tt2.html
index ec022c1415092ff7de7eb7d2f97069b9cd65930a..d39a6ef0779f3d153b060df5ab18aae76fd1702f 100644
--- a/templates/web/select_sp.tt2.html
+++ b/templates/web/select_sp.tt2.html
@@ -1,3 +1,4 @@
+[% WRAPPER index.tt2.html %]
 <div class="wizard clearfix">
     <div class="steps clearfix">
         <ol>
@@ -163,3 +164,4 @@ $( document ).ready(function() {
     $( "#entityid" ).combobox();
 });
 </script>
+[% END %]