Added code for polling