Further refactoring to IdentityProvider