refactoring and validations