refactor creation of jobs