exported sorting functions