Switching to bash, adding some checks.