Stop the script if a command goes wrong.
Add dynamic network detection.