Refactor job writting