A chunk of refactoring Job API code