Simplified polling loop code