diff --git a/bin/account-manager-client.pl b/bin/account-manager-client.pl
index 49491dbd08cc5454d5a7a5c6c05295c144cdeb7c..346069f2210b8d4e1f983e2a0e5da103166f2191 100755
--- a/bin/account-manager-client.pl
+++ b/bin/account-manager-client.pl
@@ -20,8 +20,9 @@ use IdPAccountManager::Data::AuthenticationToken;
 use IdPAccountManager::Data::AuthenticationToken::Manager;
 use IdPAccountManager::Data::TestAccount;
 use IdPAccountManager::Data::TestAccount::Manager;
+use IdPAccountManager::Data::ServiceProvider;
+use IdPAccountManager::Data::ServiceProvider::Manager;
 use IdPAccountManager::SAMLMetadata;
-use IdPAccountManager::ServiceProvider;
 use IdPAccountManager::Logger;
 
 my %options;
@@ -158,7 +159,7 @@ if ($action eq 'add_test_account') {
 
     ## Check if entry already exists in DB first
     my $service_provider =
-      IdPAccountManager::ServiceProvider->new(
+      IdPAccountManager::Data::ServiceProvider->new(
         entityid => $options{'sp_entityid'});
     if ($service_provider->load(speculative => 1)) {
         printf "Entry for %s already in DB; update it with new data\n",
@@ -169,7 +170,7 @@ if ($action eq 'add_test_account') {
           if ($options{'displayname'});
     } else {
 
-        $service_provider = IdPAccountManager::ServiceProvider->new(
+        $service_provider = IdPAccountManager::Data::ServiceProvider->new(
             entityid    => $options{'sp_entityid'},
             contacts    => $options{'contacts'},
             displayname => $options{'displayname'}
@@ -187,14 +188,14 @@ if ($action eq 'add_test_account') {
 
     my %args;
 
-    my $all = IdPAccountManager::ServiceProvider::list_service_providers(%args);
+    my $providers = IdPAccountManager::Data::ServiceProvider::Manager->get_serviceproviders(%args);
 
-    if ($#{$all} < 0) {
+    if (@$providers) {
         printf "No service provider in DB\n";
     }
 
-    foreach my $service_provider (@$all) {
-        $service_provider->print();
+    foreach my $provider (@$providers) {
+        $provider->print();
     }
 
 } elsif ($action eq 'list_authentication_tokens') {
diff --git a/bin/account-manager-web.pl b/bin/account-manager-web.pl
index 09f0ef02bbfece011067de96fdda9de65c784da7..3729cf9cd78ee59b0841127fb78b3f2ffc20aabd 100755
--- a/bin/account-manager-web.pl
+++ b/bin/account-manager-web.pl
@@ -20,7 +20,6 @@ use Template::Constants qw( :debug );
 
 use Conf;
 use IdPAccountManager::SAMLMetadata;
-use IdPAccountManager::ServiceProvider;
 
 use IdPAccountManager::WebRequest;
 
diff --git a/lib/IdPAccountManager/Data/ServiceProvider.pm b/lib/IdPAccountManager/Data/ServiceProvider.pm
index 209ac30cc3304cda1a008b422f5c69cb0732cd1a..6eee98a97c61154fd3961b45cba54e34924e2937 100644
--- a/lib/IdPAccountManager/Data/ServiceProvider.pm
+++ b/lib/IdPAccountManager/Data/ServiceProvider.pm
@@ -20,5 +20,53 @@ __PACKAGE__->meta->setup(
     unique_key => [ 'entityid' ],
 );
 
+sub new {
+    my ($pkg, %args) = @_;
+
+    my $self = $pkg->SUPER::new(%args);
+
+    $self->{dev_sp_contact} = $args{dev_sp_contact};
+
+    return $self;
+}
+
+## Print the content of a test account
+sub print {
+    my ($self, $fd) = @_;
+    $fd = \*STDOUT unless $fd;
+
+    printf $fd
+      "ServiceProvider ID=%s; entityid=%s; displayname=%s; contacts=%s\n",
+      $self->id(), $self->entityid(), $self->displayname(), $self->contacts();
+}
+
+## list contacts for this SP, including those listed in conf.dev_sp_contact
+sub list_contacts_as_array {
+    my ($self) = @_;
+
+    my %contact_list;
+
+    foreach my $contact_email (split /,/, $self->contacts()) {
+        $contact_list{$contact_email}++;
+    }
+
+    foreach my $contact_email (split /,/, $self->{dev_sp_contact}) {
+        $contact_list{$contact_email}++;
+    }
+
+    return keys %contact_list;
+}
+
+## Check if email address is a known contact (or conf.dev_sp_contact)
+sub is_contact {
+    my ($self, $email) = @_;
+
+    foreach my $known_contact ($self->list_contacts_as_array()) {
+        return 1 if (lc($email) eq lc($known_contact));
+    }
+
+    return 0;
+}
+
 1;
 
diff --git a/lib/IdPAccountManager/ServiceProvider.pm b/lib/IdPAccountManager/ServiceProvider.pm
deleted file mode 100644
index 78cdf680cb8d84b49e13c8fd7ad586dcbc9819a2..0000000000000000000000000000000000000000
--- a/lib/IdPAccountManager/ServiceProvider.pm
+++ /dev/null
@@ -1,113 +0,0 @@
-package IdPAccountManager::ServiceProvider;
-
-## Copyright (c) GEANT
-## This software was developed by RENATER. The research leading to these results has received funding
-## from the European Community¹s Seventh Framework Programme (FP7/2007-2013) under grant agreement nº 238875 (GÉANT).
-
-use strict;
-use warnings;
-
-use base 'IdPAccountManager::Data::ServiceProvider';
-
-use IdPAccountManager::Data::ServiceProvider;
-use IdPAccountManager::Data::ServiceProvider::Manager;
-
-use IdPAccountManager::Tools;
-
-use Carp;
-
-INIT {
-    ## Set error mode  to non fatal
-    IdPAccountManager::Data::ServiceProvider::Manager->error_mode('return');
-}
-
-sub new {
-    my ($pkg, %args) = @_;
-
-    my $self = SUPER::new->(%args);
-
-    $self->{dev_sp_contact} = $args{dev_sp_contact};
-
-    return $self;
-}
-
-## Print the content of a test account
-sub print {
-    my ($self, $fd) = @_;
-    $fd = \*STDOUT unless $fd;
-
-    printf $fd
-      "ServiceProvider ID=%s; entityid=%s; displayname=%s; contacts=%s\n",
-      $self->id, $self->entityid, $self->displayname, $self->contacts;
-}
-
-## list contacts for this SP, including those listed in conf.dev_sp_contact
-sub list_contacts_as_array {
-    my ($self) = @_;
-
-    my %contact_list;
-
-    foreach my $contact_email (split /,/, $self->contacts()) {
-        $contact_list{$contact_email}++;
-    }
-
-    foreach my $contact_email (split /,/, $self->{dev_sp_contact}) {
-        $contact_list{$contact_email}++;
-    }
-
-    return keys %contact_list;
-}
-
-## Check if email address is a known contact (or conf.dev_sp_contact)
-sub is_contact {
-    my ($self, $email) = @_;
-
-    foreach my $known_contact ($self->list_contacts_as_array()) {
-        return 1 if (lc($email) eq lc($known_contact));
-    }
-
-    return 0;
-}
-
-## list all test accounts
-## Class method
-sub list_service_providers {
-    my (%args) = @_;
-
-    my $persistent_accounts =
-      IdPAccountManager::Data::ServiceProvider::Manager->get_serviceproviders(
-        %args);
-    my $service_providers;
-    foreach my $persistent_sp (@{$persistent_accounts}) {
-        my $service_provider =
-          IdPAccountManager::ServiceProvider->new(
-            entityid => $persistent_sp->entityid());
-        $service_provider->load();
-        push @$service_providers, $service_provider;
-    }
-
-    return $service_providers;
-}
-
-1;
-__END__
-
-=head1 NAME
-
-IdPAccountManager::ServiceProvider - Manage Service Providers for which test accounts have been requested for the Test Identity Provider
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-=head1 SUBROUTINES/METHODS
-
-=head1 AUTHOR
-
-Olivier Salaün (olivier.salaun@renater.fr)
-
-=head1 LICENSE
-
-Copyright (c) GEANT
-This software was developed by RENATER. The research leading to these results has received funding
-from the European Community¹s Seventh Framework Programme (FP7/2007-2013) under grant agreement nº 238875 (GÉANT).
diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 42553e9669db9ea115c6116cc4e6ea7aad239ce3..97ebc20fc73f7b8b58fb5383e2ed2f0e74b6b55a 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -7,6 +7,7 @@ use English qw(-no_match_vars);
 use IdPAccountManager::Logger;
 use IdPAccountManager::Data::TestAccount;
 use IdPAccountManager::Data::AuthenticationToken;
+use IdPAccountManager::Data::ServiceProvider;
 use Conf;
 
 ## New web request
@@ -296,7 +297,7 @@ sub req_select_sp {
     }
 
     ## Create a serviceprovider object to store major parameters for this SP in DB
-    my $service_provider = IdPAccountManager::ServiceProvider->new(
+    my $service_provider = IdPAccountManager::Data::ServiceProvider->new(
         entityid       => $self->{'param_in'}{'sp_entityid'},
         dev_sp_contact => $Conf::global{'dev_sp_contact'}
     );
@@ -336,7 +337,7 @@ sub req_select_sp {
 
     } else {
 
-        $service_provider = IdPAccountManager::ServiceProvider->new(
+        $service_provider = IdPAccountManager::Data::ServiceProvider->new(
             entityid       => $self->{'param_in'}{'sp_entityid'},
             contacts       => join(',', @contacts),
             displayname    => $display_name,
@@ -391,7 +392,7 @@ sub req_generate_token {
     }
 
     ## Create a serviceprovider object to load parameters for this SP from DB
-    my $service_provider = IdPAccountManager::ServiceProvider->new(
+    my $service_provider = IdPAccountManager::Data::ServiceProvider->new(
         entityid       => $self->{'param_in'}{'sp_entityid'},
         dev_sp_contact => $Conf::global{'dev_sp_contact'}
     );