Replaced second EXISTS WHERE function using the Shunting rule
First step