Code cleanup  and addition of some options

Now the pyjob functions have completion for their options.
Several measures to reduce replication of code were taken.