Normally sort function compare the ascii values of characters. This becomes and issue when you want numbers like 1,10,2,20 to sort like 1,2,10,20. To make these numbers sort in a 'natural' order you would need to write and implement the alphanum algorithm that Dave Koelle wrote a million years ago. Here are some more information on them.