Fixed grouping functionality.