improved validate example