Refactor group manipulation functions