Refactor job submit, poll and kill

Incomplete change.