A validation helper