added data input validation