Added grouping functionality.
It's working, but really awkward because the groups aren't ordered in the same way as they come in from the API.
I will need to make it ascending/descending, and fix the awkwardness. Also removal of empty groups.