sort_fields function

Move text to the first column and set types to document variables