Some more changes to support polling, not tested yet