Refactor registration

to locate the backend communication in a factory.