added some validations and tests