Use set intersections for more condensed error checking.