Added sorting for grouped events.