Logic in validator more compact