Refinement of weighted mean and median calculation for summaries