Initial steps towards sorting, which sadly invalidates some of the previous work.