Why the duplicate array definition? you should be able to return DFUsortfields[sortField].str below (you'll need to pad for entry 0 as you have above)