more accurate sorting of line items