Added some data validation