refactoring for validation and model