Fixed ordering problem.  Changed Scott's code to not convert field names to upper case for consistency.  Added code to replace any character in a field name with _ if it is not a-zA-Z0-9_$