Changed size and isValid methods to use the proto base classes.