optimized the validator