diff --git a/bin/account-manager-web.pl b/bin/account-manager-web.pl
index 598eac1b79ceffb60fed8a5ee5fbb183e1fd425c..6415ecd95708cb2bb9e14fdc7c7b6d5802fe94f9 100755
--- a/bin/account-manager-web.pl
+++ b/bin/account-manager-web.pl
@@ -25,6 +25,7 @@ my $domains_regex = '[\w\.\-]+(,[\w\.\-]+)*';
 my %format = (
 	      ## URL
 	      #'attributeauthority' => $url_regex,
+              'sp_entityid' => $urn_or_url_regex,
 	      );
 
 my %actions = ('select_sp' => {'title_en' => 'Select your Service Provider'    },
@@ -50,6 +51,8 @@ package WebRequest;
 sub new {
   my $pkg = shift;
   my $request = {};
+  &IdPAccountManager::Tools::do_log('info', "");
+
   
   my $http_query = new CGI;
   
@@ -117,7 +120,7 @@ sub execute {
   my $status;
 
   ## Check input parameters format
-  foreach my $key (keys %{$request->{'param_in'}}) {
+  foreach my $key (keys %{$self->{'param_in'}}) {
       if ($self->{'param_in'}{$key} !~ /^\s*$/ && 
 	  defined $format{$key} &&
 	  ! ref($format{$key})) { 
@@ -222,7 +225,8 @@ sub respond {
 ## Return the list of known SPs
 sub req_get_sp_list {
     my $self = shift;
-    
+    &IdPAccountManager::Tools::do_log('info', "");
+
     my $federation_metadata = new IdPAccountManager::SAMLMetadata;
     unless ($federation_metadata->load(federation_metadata_file_path => $IdPAccountManager::Conf::global{'federation_metadata_file_path'})) {
 	      push @{$self->{'param_out'}{'errors'}}, "internal";
@@ -245,6 +249,7 @@ sub req_get_sp_list {
 ## Sample URL : https://dev-edugain.renater.fr/accountmanager?action=select_sp&sp_entityid=http%3A%2F%2Fsp.lat.csc.fi
 sub req_select_sp {
     my $self = shift;
+    &IdPAccountManager::Tools::do_log('info', "");
     
     unless ($self->{'param_in'}{'sp_entityid'}) {
         push @{$self->{'param_out'}{'errors'}}, "missing_sp_entityid";
diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm
index 275e72a5eca52236c294334f7de0e6a8e9533996..445134606ef85ec24365dec40411d60bb575c2a4 100644
--- a/lib/IdPAccountManager/Tools.pm
+++ b/lib/IdPAccountManager/Tools.pm
@@ -131,7 +131,7 @@ sub do_log {
         my $ip = $ENV{'REMOTE_HOST'}.'/'.$ENV{'REMOTE_ADDR'} || 'NOIP';
         my $date = POSIX::strftime ("%Y:%m:%d %H:%M:%S", localtime(time));
         my $user = lc($ENV{'mail'}) || 'NOEMAIL';
-        open TMP, ">>".$IdPAccountManager::Conf::global{'log_file'}; printf TMP "$date - ($level) - $ip - $user - $caller_string $message\n", @_; close TMP;       
+        open LOG, ">>".$IdPAccountManager::Conf::global{'log_file'}; printf LOG "$date - ($level) - $ip - $user - $caller_string $message\n", @_; close LOG;       
     }
     return 1;
 }
diff --git a/templates/web/errors.tt2.html b/templates/web/errors.tt2.html
new file mode 100644
index 0000000000000000000000000000000000000000..5cfe4b42095c55e5f44ad41ac15db046bde72fac
--- /dev/null
+++ b/templates/web/errors.tt2.html
@@ -0,0 +1,21 @@
+ [% FOREACH err IN errors %]
+
+<p class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
+  Error: 
+
+  [% IF err == 'unknown_action' %]
+   Unknown action
+
+  [% ELSIF err == 'internal' %]
+   internal error; administrators of the federation registry have been notified.
+
+  [% ELSIF (matches = err.match('missing_(\w+)')) %]
+   missing parameter '[% matches.0 %]'
+
+  [% ELSE %]
+   [% err %]
+
+  [% END %] <!-- autorisation -->
+</p>
+<br/>
+ [% END %] <!-- FOREACH -->
diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html
index 273cd53bb2dee3f349c7d79d5110af567385f9ad..37e02b5017c64cac1ca5aa41b0c31a911dfc69df 100644
--- a/templates/web/index.tt2.html
+++ b/templates/web/index.tt2.html
@@ -87,48 +87,14 @@ div.important{border-style:solid;border-color:black;border-width:1px;background-
 
 [% IF errors %]
 <div class="ui-widget">
- [% FOREACH err IN errors %]
-
-<p class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
-  Error: 
-
-  [% IF err == 'unknown_action' %]
-   Unknown action
-
-  [% ELSIF err == 'internal' %]
-   internal error; administrators of the federation registry have been notified.
-
-  [% ELSIF (matches = err.match('missing_(\w+)')) %]
-   missing parameter '[% matches.0 %]'
-
-  [% ELSE %]
-   [% err %]
-
-  [% END %] <!-- autorisation -->
-</p>
-<br/>
- [% END %] <!-- FOREACH -->
+[% PROCESS 'templates/web/errors.tt2.html' %]
 </div>
 [% ELSE %]
 
 
 [% IF notifications %]
 <div class="ui-widget">
- [% FOREACH notif IN notifications %]
-<p class="ui-state-highlight ui-corner-all" style="border: 2px solid #10427a; background: #DFF1EE;padding: 0.7em;"><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
-  Notice: 
-
-  [% IF notif == 'done' %]
-
-  Operation has been performed
-
-  [% ELSE %]
-
-   [% notif %]<br/>
-
-  [% END %]
-
- [% END %] <!-- FOREACH -->
+[% PROCESS 'templates/web/notices.tt2.html' %]
 </b></div>
 [% END %] <!-- notifications -->
 
diff --git a/templates/web/notices.tt2.html b/templates/web/notices.tt2.html
new file mode 100644
index 0000000000000000000000000000000000000000..c936d34867d9d1a8d980bdbd7ced6f6d5a03c3a1
--- /dev/null
+++ b/templates/web/notices.tt2.html
@@ -0,0 +1,15 @@
+ [% FOREACH notif IN notifications %]
+<p class="ui-state-highlight ui-corner-all" style="border: 2px solid #10427a; background: #DFF1EE;padding: 0.7em;"><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
+  Notice: 
+
+  [% IF notif == 'done' %]
+
+  Operation has been performed
+
+  [% ELSE %]
+
+   [% notif %]<br/>
+
+  [% END %]
+
+ [% END %] <!-- FOREACH -->
\ No newline at end of file