Adding more scenarios for grouping elements by index and also for logical based index slicing