refactoring to include validation with callbacks