updated validation class to add error and message