adding get average function