tweaked mean function