added validations and unit tests