The breaks you have included in the loops for Scenario V: and Scenario VI: induce errors in counting overlapping entities.
The breaks you have included in the loops for Scenario V: and Scenario VI: induce errors in counting overlapping entities.