flag_array wasn't being passed around everywhere it is needed