added function to create groups