Validator and Constraints

This not mine constraint, this was rebased from daniila PR