code for computing xp-ehh