Add counter to polling function so we don't poll forever, make sleep length a variable.