example updated for average event