refactoring validation machinery