Added the code that make the validation

Added the code that make the validation and handle the result.