Added method to group arrays