added validate method.