validation and generator