adding validation check