refactored polling
numsamples