Major refactor of types.h.