added polling into the example