Add class group computation code