got sorting working