refactored user providercode