Constants and functions in output should be sorted by sort. Count output should be ordered consistently.