use poller inside future instead of loop to control the timeout. a bunch of other changes according the code review