Refactored TypeSystem classes.