Working version using polling. Missing timeout.

What do you think?