Updated pollAndWork so that it actually works