modifications to calculate average time of programs.