adding getAverage function