Upgrade to use exists query.