better sorting and labeling