Modified testing script to calculate the average of the results