averaging an array