refactor group item processing