Added deftypes_by_name.
Fixed bug in deftypes_by_name, made stuff use it to be more efficient.