Implemented worker_do_work function.