tidy up TypeSystem codes