Added a little input validation