Generic validator