Better wait logic.
Extra check for length before trying to read jobId files.
Comment out the arbitrary delays between commands.