reorganize mean functions