better sorting in output list