better validation method