refactoring code, add check if provider is enabled from service