adding validation functionality