modified to meaningful variable names and added condition to avoid divide by zero error