introduced generators to simplify logic