Shallow sort function