Adding handling to set the exit code for the script.