If loop.js were *only* available on the worker thread, it might make more sense to have this as a "global" helper function like it is, since many things in the worker thread might use it. However, no other code on the main thread has any use for it currently, and it's such a short/simple function that having it repeated all over the place isn't necessarily such a bad thing. That is, if some code on the main thread had to make use of a similar function, it would probably be cleaner to define it locally than to try and reuse the same code (depending, of course).