tweaked part attribute sorting algorithm