Sorting works as intended