added set -e and set pipe fail to all commands