add get all groups

It's probably worth splitting the first branch of the conditional out into its own method. It's big enough that reading it breaks the flow of the surrounding code and we end up with conditionals nested deeper than I'm entirely comfortable with.