Added validations and unit tests