refector validation code