Pass correct attr to the validation functions. Add tests