added unit tests and validations