Refactor out attribute parsing, since it's going to be the same for all the classes.