add type validations and tests