Main program in calculate_average.L Now functions are nested