refactored jobs.py into a python library + cosmetic changes