add a function for validation