added logic for provider