implement data validation