added data validation