Added variable to calculate average