Adding functions for working out separated groups of agents