Refactored validator generator (little speed gain)