Adding first pass at a worker process. Messy and needs some refactoring
Cleaning up some of the worker code