Improved wait_for_polling_result implementation