diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm
index e4c455bf305ff80893066fc850b410e57767c6a1..e47cd1d77edc6f30bb95312f011e3c5d676a656c 100644
--- a/lib/IdPAccountManager/SAMLMetadata.pm
+++ b/lib/IdPAccountManager/SAMLMetadata.pm
@@ -51,7 +51,7 @@ sub parse {
 
         foreach my $child ($EntityDescriptor->childNodes()) {
 
-            ## Ignoringnodes of type XML::LibXML::Text or XML::LibXML::Comment
+            ## Ignoring nodes of type XML::LibXML::Text or XML::LibXML::Comment
             next unless $child->nodeType() == XML_ELEMENT_NODE;
 
             if ($child->localname() eq 'IDPSSODescriptor') {
@@ -87,8 +87,8 @@ sub parse {
                 ## We also check the index to select the ACS that has the lower index
                 my ($index_saml1, $index_saml2);
                 foreach my $sso (
-                    $child->getElementsByLocalName('AssertionConsumerService'))
-                {
+                    $child->getElementsByLocalName('AssertionConsumerService')
+                ) {
 
                     ## Extracting endpoints information
                     push @{ $data->{sp_endpoints} }, {
@@ -104,42 +104,37 @@ sub parse {
                 }
 
                 foreach my $attribute (
-                    $child->getElementsByLocalName('RequestedAttribute'))
-                {
+                    $child->getElementsByLocalName('RequestedAttribute')
+                ) {
 
                     ## Requested attributes information
-                    push @{ $data->{requested_attribute} },
-                      {
-                        'friendly_name' => $attribute->getAttribute('FriendlyName'),
-                        'name'          => $attribute->getAttribute('Name'),
-                        'is_required'   => _boolean2integer(
+                    push @{ $data->{requested_attribute} }, {
+                        friendly_name => $attribute->getAttribute('FriendlyName'),
+                        name          => $attribute->getAttribute('Name'),
+                        is_required   => _boolean2integer(
                             $attribute->getAttribute('isRequired')
                         )
-                      };
+                    };
                 }
 
             } elsif ($child->localname() eq 'Extensions') {
 
                 foreach my $registrationinfo (
-                    $child->getElementsByLocalName('RegistrationInfo'))
-                {
+                    $child->getElementsByLocalName('RegistrationInfo')
+                ) {
 
-                    $data->{registration_info}
-                      {registration_authority} =
+                    $data->{registration_info}->{registration_authority} =
                       $registrationinfo->getAttribute('registrationAuthority');
-                    $data->{registration_info}
-                      {registration_instant} =
+                    $data->{registration_info}->{registration_instant} =
                       $registrationinfo->getAttribute('registrationInstant');
                     foreach my $policy (
                         $registrationinfo->getElementsByLocalName(
                             'RegistrationPolicy')
-                      )
-                    {
+                    ) {
                         my $lang = $policy->getAttribute('lang');
-                        if ($lang && $lang eq 'en') {
-                            $data->{registration_info}->{registration_policy} =
-                                $policy->textContent();
-                        }
+                        next unless $lang && $lang eq 'en';
+                        $data->{registration_info}->{registration_policy} =
+                            $policy->textContent();
                     }
                 }
             } elsif ($child->localname() eq 'ContactPerson') {
@@ -155,9 +150,9 @@ sub parse {
                 }
             }
 
-            foreach
-              my $displayname ($child->getElementsByLocalName('DisplayName'))
-            {
+            foreach my $displayname (
+                $child->getElementsByLocalName('DisplayName')
+            ) {
 
                 $data->{display_name}->{ $displayname->getAttribute('xml:lang') } =
                     $displayname->textContent();
@@ -173,17 +168,17 @@ sub parse {
 
             }
 
-            foreach
-              my $description ($child->getElementsByLocalName('Description'))
-            {
+            foreach my $description (
+                $child->getElementsByLocalName('Description')
+            ) {
 
                 $data->{description}->{ $description->getAttribute('xml:lang') } =
                     $description->textContent();
             }
 
-            foreach
-              my $contact ($child->getElementsByLocalName('ContactPerson'))
-            {
+            foreach my $contact (
+                $child->getElementsByLocalName('ContactPerson')
+            ) {
 
                 my %contact_details;
                 $contact_details{type} =
@@ -196,14 +191,15 @@ sub parse {
             }
 
             foreach my $sso (
-                $child->getElementsByLocalName('OrganizationDisplayName'))
-            {
+                $child->getElementsByLocalName('OrganizationDisplayName')
+            ) {
                 $data->{organization} = $sso->textContent();
             }
 
             ## Getting X.509 certificates
-            foreach my $cert ($child->getElementsByLocalName('X509Certificate'))
-            {
+            foreach my $cert (
+                $child->getElementsByLocalName('X509Certificate')
+            ) {
                 $data->{certificate} = $cert->textContent();
             }
         }