Input validation.