added flatten array