remove duplication in validator