Refactor jobs.py