Update the test_sort_updates unit test to verify the length
Avoid returning duplicate updates from sort_updates