modified to validate