Natural sorting of numbers ("1" < "2" < "10")

This needs testing to see if it has any other unwanted effects.

Closes Trac ticket 1031