adding average calculation