Flatten Nested Arrays

Use powerful primitives for handling nested arrays.