Improved sorting on array/string