Added polling support
Fixing type errors wrt to poll. Added poll test.