try to work out the sorting