Refactoring tests and validations