sort and tests