Adding input validation.