optimied mean computation
extra tests