I found a difficulty to determine the scope of modifiers in long sentences. To make it clearer, see the following sentences. My translation may be wrong.
Sentence 1
新しい工場を建てるに当たって(は)、環境への影響などを調べ、地域の人々と話し合う機会を持つ必要がある。
Prior to building a new factory, it is necessary to have an opportunity to
investigate things like its effect on environment, and
speak with the people in that region.
Here I assume that 環境への影響などを調べ、地域の人々と話し合う is the modifier of 機会.
Sentence 2
進学に当たって(は)、学校を見学したり、先輩に話を聞いたり、先生に相談したりして、できるだけ選択肢を広げて考えることが重要だ。
Prior to entering a higher school, the necessary things are
to do things like observing the school, listening to stories from seniors, discussing with teachers,
to widen the alternatives as much as possible, and
to think.
Here I assume that 学校を見学したり、先輩に話を聞いたり、先生に相談したりして、できるだけ選択肢を広げて考える is the modifier of こと.
Questions
How to determine the scope of modifiers in long sentences?