- Fixed averaging function