Check process exit codes + various other improvements.