Could this be replaced by a direct query against i_s.types?