added validations and testing