add upperTMean helper function