Validate now works in a different way

Instead of test method throwing an exception the validate() function
now does this job.