Fix sorting of name list

all the sorting code has been moved to a single sorting function to prevent issues with subsequent sortings ignoring previous ones.

alpha sorting is now done on all lower case.