Add poll test coverage. Add polling enable/disable setting. Refactor polling to simplify and make testable.