Fixed Windows line endings on the shell script, and fixed a division by zero error.