Refactoring into a class. Adding clear information about which attributes were invalid.