added some unit tests and validations