completed code to add and delete groups of items