changed a join of the bridge to two subqueries referencing the bridge