replaced Entity.type with Entity.types, which keeps track of every type along the inheritance hierarchy