Refactoring constraints to make better use of the new closure
Refactoring validtor