refactoring get_next_job into worker
worker needs to call get_next_job as well