Trying to flatten array