Improved polling logic.