wait() just did finish() and returned errors; no need for two functions.
Add the worker queue code to a separate file for better organisation and readability.