Move the collection stuff out into it's own function that can be called
async.  Add a counter to the main loop to let us know how many unique
devices we've seen so far.