Preserve order for grouping fields.
Make it even simpler.
Merge pull request #220 from funkenblatt/fix-grouping

Preserve order for grouping fields.