refactor job retrieval, little bit more robust and a little bit better db saving.