added some validation.