Maybe we can accommodate these group cases also in that function or else a separate function