Improve the horrible polling loop a little.