clean up unnecessary code for average
clean up unnecessary code for average