Added data validation and more tests