added avarage calculator function