Simplify if  exists logic