Refactored code to allow a path to the worker thread to be set at run time