Cleaned up the worker code.