refactor polling