Made the validation error messages more robust and added tests