Refactor for more efficient job handling