Added a validation function
Merged