Adding some input validation.