minor improvements and pass through shellcheck.net