Sorting mostly done.

last test is to resort when any property on an item changes: not sure if we can
even do this at present.