determine when next group function is called