This fixes the typographic error that always assigned an undefined
array to `$names`, which made `$list_size` = 0 and triggered a
divide by zero error on the next line.
Refactor the functions and group listings to have fewer functions,
but have them take group names as parameters.
Pull group definitions in to a single associative array.