refactored polling