Bash best practices and cleanup