Fixed sorting in groups. Grouping now works! Just need to implement
stuff in the aggregates.