changing .flatten to array and or to ||