changed validation to use element-level validation