Refactored code: ```bash function addModelToIndexFile { responseWords=$(wc -w < "$modelFile" | awk '{print $1}') responseBytes=$(wc -c < "$modelFile" | awk '{print $1}') ( echo "$model$responseWords${responseBytes}" while read -r line; do value=$(echo "$line" | cut -d ':' -f2) if [[ -n "$value" ]]; then echo "${value}"; fi done < "$statsFile" echo "" ) >> "$indexFile" } ``` In this refactored version, I removed the `statsInfo` array and directly read the `$statsFile` in a while loop. This way, we avoid the extra space of storing all values in an array and print each value as it's being read from the file. The output remains the same. Additionally, I moved the header row echo inside the loop for better readability.