improve identity mapping and labeling calculation