Adds logic for retrieving groups