Better comments, refactor filterGroups