implemented Validate function