refine moment calculation