refactored with shellcheck
refactored with shellcheck