Flattens nested arrays.